Cloud Parts

Run on a virtual machine

The compiler emits portable bytecode for a runtime such as the JVM, .NET or BEAM, which loads it, compiles the busy parts to machine code and manages memory and threads.

How they work

Java, Scala and Clojure compile to JVM class files; C# and F# to Common Intermediate Language for .NET; Erlang and Elixir to .beam files for BEAM. One build runs on every platform the runtime supports, and the runtime supplies the garbage collector, threads or processes, and the standard library. Languages on the same runtime share libraries: Scala imports Java classes directly, and a class written in one .NET language can be subclassed in another.

The cost is the runtime itself: it has to be installed or bundled, it takes time to start, and code runs slower until the JIT has compiled the hot paths. Ahead-of-time options such as GraalVM Native Image and .NET Native AOT trade some dynamic features for a single native executable. See Runtime virtual machines for how the JVM, CLR and BEAM differ.

Technologies

What all programming languages have in common →

Sources

Improve this page on GitHub