Reputation: 753
I heard about scala-native recently and it sounds very interesting !
I'm curious about what does native means here ?
what does "ahead-of-time compiler" means ?
I think descriptions in the web site and github repository are not clear.
Upvotes: 7
Views: 4115
Reputation: 1694
Can I run my scala program without JVM using scala-native?
Yes, the goal of Scala Native is to support compilation of Scala programs without any kind of VM. We've not had a stable release yet, follow us on twitter to be the first to know when this happens.
I'm curious about what does native means here ?
Scala has historically been a language that runs on Java Virtual Machine. Unlike native applications, Java applications are built on top of an additional indirection layer that maps virtual machine instructions to underlying hardware instructions. The code is still eventually compiled to native code, the only difference is that it happens later on, during the run of the application. This is also known as just-in-time compilation strategy.
what does "ahead-of-time compiler" means ?
"Ahead-of-time" means that mapping from high-level Scala code to low-level native code is done in advance, before the application is actually run. This saves us some indirection overhead, and reduces overall resource consumption.
Upvotes: 17
Reputation: 3398
A key piece of information from the github readme "Project is currently in pre-release", it was announced pretty recently.
Native generally means running on "bare metal", producing binaries with non-virtual machine specific binary instructions (x86 machine code for example).
Ahead of time means that the final machine instructions are produced during the compilation phase, unlike a "Just In Time" compiler such as is used in the JVM to convert JVM bytecode to the appropriate, optimized, machine instructions. See the accepted answer to this question for a really good explanation of these concepts.
Upvotes: 3