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.
You will need Java to run Scala code. If you only want to run but not compile Scala code, JRE should be enough. JRE provides the JVM and Java libraries that Scala wraps over. Current version of Scala seems to require Java 8 or above.
Scala gives you an illusion of an interpreted language. But actually it is a compiled language, wherein everything you type gets compiled to the byte code and it runs within the JVM. There is a big difference between Scala and other programming languages, which are the interpreted ones.
Although Scala compiles to Java bytecode, it is designed to improve on many of the perceived shortcomings of the Java language.
Scala is a statically typed language that is based on Java. Thus, anyone who's well-versed with Java's syntax will find it pretty easy to learn Scala.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With