Scaled-back Scala variant cuts ties to the JVM

Taking advantage of the LLVM compiler platform, Scala Native expands language's opportunities on resource-constrained devices

Scaled-down Scala variant cuts ties to the JVM
Credit: saeedkebriya

Scala Native, which brings the Scala language closer to bare metal by leveraging LLVM compiler infrastructure, has been released, expanding opportunities for the platform on smaller devices.

The project, which features an optimizing ahead-of-time compiler, has reached feature-completeness, said Denys Shabalin, who has been in charge of Scala Native. Unlike the reference implementation of Scala, which generates bytecode to run on top of the Java Virtual Machine, the Scala Native toolchain produces stand-alone native executables. Shabalin noted that "this opens the door for Scala to be used in environments where [a] full-blown virtual machine is usually an overkill: command-line tools, resource-constrained hardware applications, video games, etc."

Scala Native's key is the compiler generating LLVM intermediate representation, used to produce efficient platform-dependent machine code. The project also features a lightweight managed runtime and support for the entire Scala language with "neglible" semantic differences, Shabalin said. The 0.1 release offered this week supports existing Scala IDEs and integrates with the sbt build tool, and the core subset of JDK base libraries is supported as well.

Billed as a general-purpose language supporting functional and object-oriented paradigms, Scala itself also has been previously tweaked to compile to JavaScript via Scala.js. LLVM, meanwhile, features modular compiler and toolchain technologies, attempting to support both static and dynamic compilation of arbitrary programming languages. It just moved to a 4.0.0 release this week, featuring improved performance and experimental support for coroutines, which can be an alternative to threading.

This story, "Scaled-back Scala variant cuts ties to the JVM" was originally published by InfoWorld.

Computerworld's IT Salary Survey 2017 results
Shop Tech Products at Amazon