BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Julia 1.7 Extends its Threading Capabilities, Improves Type Inference, and More

Julia 1.7 Extends its Threading Capabilities, Improves Type Inference, and More

This item in japanese

Julia 1.7 brings a number of significant enhancements, including new threading capabilities, new Package Manager features, improved type inference, and new syntactic features. It is also the first release to run natively on Apple Silicon.

Julia has been progressing a lot in recent releases to better supoprt multithreaded programs. Julia 1.7 fixes a number of race conditions in the language runtime and improves the design of the default random number generator to make it more thread-friendly. Most importantly, it adds support for atomics as a primitive language feature as described in the Julia Atomics Manifesto.

The cornerstone of atomics in Julia is the @atomic macro, that can be used to mark any expression so the compiler will rewrite it as an atomic expression. For example, you can write y = @atomic a.b.x += 1 to atomically access and increment a.b.x. Other macros that are used with atomics are @atomicswap and @atomicreplace.

Atomics provide a low-level foundation for atomicity that can be used to build thread-safe abstractions such as actors, parallel transducers, and so on.

As mentioned, Julia 1.7 also improves type inference, with benefits on inference performance. In particular, Julia is now able to propagate certain type constraints across function calls, including conditional constraints constants for union-split signatures, constants for calls through invoke, and others. It can also replace more runtime computations with pre-computed constants to resolve conditional branches at compile time.

Speaking of tooling, the Julia Package Manager is now able to automatically install a package that is available but not installed when attempting to load it in the REPL. This is a nice improvement for the developer experience in the REPL. Additionally, it also brings a new manifesto format that enables the specification of the Julia version that was used to install all packages that are listed in the manifesto itself. This makes it possible for Pkg to warn the user when mixing language versions on the same manifesto, which could lead to conflicts in case, for example, a newer language version required a more recent version of a package that was installed by a previous language version.

At the language level, Julia 1.7 includes also a number of new syntactic features, such as the ability to embed newlines inside strings, to destructure objects based on the names of their properties, and to define multidimensional array literals. For multidimensional arrays, you can for example write a vector of two 2x2 matrices like this:

[1 2 ; 3 4 ;;; 5 6 ; 7 8]

As a final note, Julia 1.7 is the first Julia release to natively support Apple Silicon, although only experimentally.

Julia is a high-level, dynamic, general-purpose programming language that is specifically aimed for numerical analysis and computational science. Its major tenets are parametric polymorphism, a.k.a generic programming, in a dynamic programming context, and multiple dispatch.

Rate this Article

Adoption
Style

BT