Julia (programming language)
|Paradigm(s)||Multi-paradigm: procedural, multiple dispatch, functional, meta|
|Designed by||Jeff Bezanson, Stefan Karpinski, Viral B. Shah, Alan Edelman (MIT Group Leader)|
|Stable release||0.2.0 (November 16, 2013)|
|Typing discipline||Dynamic with optional type annotations and type inference|
|Influenced by||MATLAB, Scheme, Common Lisp, Lisp, C, Python, Perl, Ruby|
|OS||Linux, OS X, FreeBSD, Windows|
|Usual filename extensions||.jl|
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. Julia is written in C, C++, and Scheme using the LLVM compiler framework, while most of Julia's standard library is implemented in Julia itself. Development of Julia began in 2009 and an open-source version was publicized in February 2012. Unusual aspects of Julia's design include having a sophisticated, expressive type system with dependent parametric types in a fully dynamic programming language and adopting multiple dispatch as its core programming paradigm. Each of these features has appeared in Lisp dialects such as Common Lisp and Dylan, but the combination of them in a single language is unique (see language features). The most notable aspect of the Julia's implementation is its performance, which often comes within a factor of two of fully optimized C code, putting it in the performance realm of compiled languages.
Julia draws significant inspiration from various dialects of Lisp, including Scheme and Common Lisp, and it shares many features with Dylan – another multiple-dispatch-oriented dynamic language with syntax – 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. 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 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. Julia's combination of parametric types and functions that are generic by default is extremely useful for efficient numerical programming. By convergent design, Fortress also exhibits this combination of features; 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:
|Language||Type system||Generic functions||Parametric types|
|Common Lisp||dynamic||opt-in||yes (but no dispatch)|
Another traditional Lisp feature included in Julia is homoiconicity: Julia represents its own code in memory using a user-accessible data structure, thereby allowing programmers to both manipulate and generate code which the system can evaluate. This makes complex code generation and transformation far simpler than in systems without this feature. A relatively simple example of the latter is an assert macro that will raise an error if an expression is false:
macro assert(ex) :($ex ? nothing : error("Assertion failed: ", $(string(ex)))) end
Notice that while the argument to a function are typically variables, the arguments to macros are expressions. Given an expression, e.g.
the macro generates the new expression
1==0 ? nothing : error("Assertion failed: ", "1==0")
where the original expression has been spliced into the condition slot of the ternary operator and has been converted to a string for the error message. Now if the original expression evaluates as true, nothing happens, where if the expression evaluates as false, an error is raised.
In the Julia packaging system each package is a Git repository that can be stored in any publicly accessible location. A master package listing that includes package dependency information is maintained in METADATA.jl, enabling easy installation from the Julia prompt:
Packages are typically written in Julia but can include both binaries and code written in other languages, which can be automatically compiled at package install time by the package manager.
- "The Julia Language" (official website).
- Bryant, Avi (Oct 2012). "Matlab, R, and Julia: Languages for data analysis". O'Reilly Strata. Retrieved 7 February 2013.
- Krill, Paul. "New Julia language seeks to be the C for scientists". InfoWorld. Retrieved 7 February 2013.
- "Julia: A Fast Dynamic Language for Technical Computing" (PDF). 2012.
- "Why We Created Julia" (World Wide Web log). Feb 2012. Retrieved 7 February 2013.
- Gibbs, Mark (2013‐1‐9). Pure and Julia are cool languages worth checking out. "Gear head". Network World (column). Retrieved 7 February 2013.
- "METADATA.jl" (central package listing for Julia)
- "Julia Studio" (official website).