Julia is a high-level dynamic programming language designed to address
the requirements of high-performance numerical and scientific computing while
also being effective for general-purpose programming, web use or as a
specification language. Distinctive aspects of Julia's design include having
a type system with parametric types in a fully dynamic programming language, and
adopting multiple dispatch as its core programming paradigm. It allows
concurrent, parallel and distributed computing, and direct calling of C and
Fortran libraries without glue code. Julia is garbage-collected, uses eager
evaluation, and includes efficient libraries for floating-point
calculations, linear algebra, random number generation, fast Fourier
transforms, and regular expression matching.
Language features According to the official website, the
main features of the language are: Multiple dispatch: providing ability to
define function behavior across many combinations of argument types
Dynamic type system: types for documentation, optimization, and
dispatch Good performance, approaching that of
statically-typed languages like C Built-in package manager
Lisp-like macros and other metaprogramming facilities
Call Python functions: use the PyCall package
Call C functions directly: no wrappers or special APIs
Powerful shell-like capabilities for managing other processes
Designed for parallelism and distributed computation
Coroutines: lightweight "green" threading
User-defined types are as fast and compact as built-ins
Automatic generation of efficient, specialized code for different argument
types Elegant and extensible conversions and
promotions for numeric and other types Efficient support for Unicode, including
but not limited to UTF-8 Multiple dispatch is a generalization of
single dispatch – the polymorphic mechanism used in common object oriented
languages – that uses inheritance. In Julia, all concrete types are subtypes
of abstract types, directly or indirectly subtypes of the "Any" type,
which is the top of the type hierarchy. Concrete types can not be subtyped, but
composition is used over inheritance, that is used by traditional
object-oriented languages. Julia draws significant inspiration from
various dialects of Lisp, including Scheme and Common Lisp, and it shares
many features with Dylan – also a multiple-dispatch-oriented dynamic
language – and Fortress, another numerical programming language with
multiple dispatch and a sophisticated parametric type system. While CLOS adds
multiple dispatch to Common Lisp, the addition is opt-in: only user-defined
functions explicitly declared to be generic can be extended with new
multimethods. Julia's macros – also known as hygienic
macros, used to implement metaprogramming, similar to macros used
in Lisp – are more powerful and different from non-hygienic macros used
in some other languages such as C. In Julia, Dylan and Fortress, on the
other hand, this extensibility is the default, and the system's built-in
functions are all generic and extensible. In Dylan, multiple dispatch
is as fundamental as it is in Julia: all user-defined functions and even basic
built-in operations like + are generic. Dylan's type system, however, does not
fully support parametric types, which are more typical of the ML lineage of
languages. By default, CLOS does not allow for dispatch on Common Lisp's
parametric types; such extended dispatch semantics can only be added as an
extension through the CLOS Metaobject Protocol. By convergent design, Fortress
also features multiple dispatch on parametric types; unlike Julia, however,
Fortress is statically rather than dynamically typed, with separate
compilation and execution phases. This matrix of language features is
summarized in the following table: Interaction
The Julia official distribution includes an interactive session shell, called
Julia's REPL, which can be used to experiment and test code quickly. The
following fragment represents a sample session on the REPL:
The REPL gives user access to the system shell and to help mode, by pressing ; or
? after the prompt, respectively. The REPL also keeps the history of commands,
even between sessions. For other examples, see the Julia documentation,
which gives code that can be tested inside the Julia's interactive section
or saved into a file with a .jl extension and run from the command line
by typing: $ julia
Julia is also supported by Jupyter, an online interactive "notebooks"
environment. See for other ways in the next section.
= To use Julia with other languages = Julia's ccall keyword is used to call
C-exported shared library functions individually or: "Clang.jl includes a
generator to create Julia wrappers for C libraries from a collection of header
files. [..] Clang.jl tends to be used on large codebases". Calling name mangled
C++ functions directly is possible, but a "library to call C++ is available that
relies on "staged functions", that requires 0.4.0."
Many packages are available e.g. to call other languages from within Julia. For
example, a package, JavaCall.jl, is available to call Java from Julia;
Mathematica.jl, to call Mathematica, ObjectiveC.jl "allows you to call
Objective-C methods using native syntax", support for using with Erlang
is possible with ErlPort.jl, calling Rust is possible, and node-julia allows
using JavaScript/node.js for asynchronous processing web/server use.
For PHP, Perl and more languages, Polyglot.jl allows "transparent
remote/recursive evaluation [calling] functions in other languages as if they
were regular Julia functions. It also allows other languages to call Julia
functions as if they were native." For use with Ruby see the For web
use-section. Julia also has native and wrapper packages for symbolic
computation. An interface "between Julia and Torch
using ZMQ" is available for machine learning.
Julia has Unicode support, with UTF-8 used for source code and e.g. optionally
allowing common math symbols for many operators, such as ∈ for the in
operator. For strings UTF-8, UTF-16 and UTF-32 are fully supported encodings,
but for more support, see optional packages ICU.jl and UnicodeExtras.jl.
Julia has packages supporting markup languages such as, HTML, XML, JSON, BSON
etc. Displaying assembly code
It is possible to display the compiled assembly code for any function typed in
the REPL. For instance, the operator +, which is just a function through
syntactic sugar: julia> code_native(+,)
Warning: Unable to find function pointer ERROR: no method found for the specified
argument types in code_native at reflection.jl:159
julia> 1.0 + 2.0 3.0
julia> code_native(+,) .text
Filename: float.jl Source line: 120
push RBP mov RBP, RSP
Source line: 120 addsd XMM0, XMM1
pop RBP ret
Implementation Julia's core is implemented in C and
C++, its parser in Scheme, and the LLVM compiler framework is used for
just-in-time generation of 64-bit or 32-bit optimized machine code depending
on the platform Julia runs on. With some exceptions, the standard library is
implemented in Julia itself. The most notable aspect of Julia's implementation
is its speed, which is often within a factor of two relative to fully
optimized C code. Development of Julia began in 2009 and an open-source version
was publicized in February 2012. Julia, the 0.3 line, is on a monthly
release schedule where bugs are fixed and some new things from 0.4 are
backported. = Current and future platforms =
While Julia uses JIT – Julia generates native machine code, directly, the first
time a function is run. Current support is for newer x86 or
older i386 processors and in 0.4.0: 32-bit ARM architecture, 64-bit ARMv8
and PowerPC being worked on. = Julia2C source-to-source compiler =
A Julia2C source-to-source compiler from Intel Labs is available. This
source-to-source compiler is a fork of Julia, that implements the same Julia
language syntax, which emits C code instead of native machine code, for
functions or whole programs. The compiler is also meant to allow
analyzing code at a higher level than C. Notes
References External links
Official website The Julia manual
Julia Package Listing – a searchable listing of all registered packages