Julia: Practical Restrictions For A Scientific-Computing Language
Julia is a high-level, dynamic programming language for scientific computing. Designed for a high level of code reuse and extensibility, Julia is built around multiple dynamic dispatch. To achieve performance, the language relies on an optimizing just-in-time compiler. The language is intentionally designed with a few unusual restrictions to make compilation predictable and to simplify the compiler implementation.
For one, Julia supports nominal subtyping but not inheritance: every user-defined type that is concrete is also final. This enables the compiler to perform various optimizations for concrete values, most importantly, dispatch elimination.
Furthermore, Julia employs an unusual semantics of eval—a function for executing code dynamically—called “world age”. Unlike other dynamic languages, Julia delays when eval’ed code becomes available to the rest of the program, thus allowing the compiler to retain pre-eval optimizations. Corpus analysis of Julia code shows that such delaying semantics is practical in most cases.
By combining powerful multiple dispatch with these intentional restrictions, Julia achieves both flexibility and impressive performance.