Sage-Code Laboratory

Julia Features

We believe that Julia has a great potential to become the most popular programming language. But what makes Julia a good candidate for higher popularity? It looks better than Python, feels better than Lisp, runs fast like Fortran. In this article we try to enumerate the most significant features that are implemented in Julia.

Julia implements LLVM-based just-in-time (JIT) compiler. Combined with the languageā€™s design allow it to approach and often match the performance of C. That means we have a dynamic language, that uses native computer types to create a fast and optimized program for different platforms. Brilliant !!!

Feature Name Description
Performance Approaching that of statically-compiled languages like C and Fortran
Co-routines Lightweight threading designed for parallelism and distributed computation
Multiple dispatch Ability to define function behavior across many combinations of argument types
Dynamic type system Define advanced types for documentation, optimization, and dispatch
User-defined types These types are as fast and compact as built-in types
Type inference Type is created determined automatically from literals
Meta-programming Lisp-like macros and other meta-programming facilities
Call Python Can be used to call python functions using PyCall package
Call C functions Direct C call with no wrappers or special APIs
Interpreter Powerful shell-like capabilities for managing other processes
Unicode Strings Efficient support for Unicode including but not limited to UTF-8
Unicode Operators We can use Unicode symbols as operators
Julia hoisting The ability to use a type or a function before it is defined

Multiple dispatch

Dispatch technique is the capability of a language to allow creation of polymorphic functions or methods. This is a function that can act on different argument types. In Julia we can create multiple versions of the same function for each argument type or combination of types. These sub-functions are called methods.

A function can have parameters with no type. In this case a dispatch is not possible and the arguments will have type "Any". The function has only one method. To make dispatch possible we must use a type annotation for one or more arguments using two column symbol "::" that is named "is an instance of type …".

In multiple dispatch we use all parameters to identify a method. In Object Oriented programming single dispatch is used. Only one parameter is used to identify a method. The methods are attached to the first argument that is the type. In Java this parameter is invisible (default) and is the current object "this". In python this parameter is called "self". In Julia we do not have a similar default parameter.

Before we can use multiple dispatch we have to understand the types. Once we define types we can create multiple methods for these types. Therefore in Julia types are the corner stone of Julia language. Is the foundation Julia philosophy.

Read next: Syntax Overview