In general, the semantics of the Scala Native language are the same as Scala on the JVM. However, a few differences exist, which we mention here.
Annotations and types defined
scala.scalanative.unsafe may modify semantics
of the language for sake of interoperability with C libraries, read more about
those in Native code interoperability section.
Scala Native doesn’t yet provide libraries for parallel multi-threaded programming and assumes single-threaded execution by default.
It’s possible to use C libraries to get access to multi-threading and synchronization primitives but this is not officially supported at the moment.
Finalize method from
java.lang.Object is never called in Scala Native.
Generally, Scala Native follows most of the special error conditions similarly to JVM:
IndexOutOfBoundsExceptionon out-of-bounds access.
ClassCastExceptionon incorrect casts.
Accessing a field or method on
Integer division by zero throws
There are a few exceptions:
Stack overflows are undefined behavior and would typically segfault on supported architectures instead of throwing
Exhausting a heap space results in crash with a stack trace instead of throwing
Continue to Native code interoperability.