Elixir v1.20 introduces gradual typing and compilation boosts
The latest update brings set-theoretic types, improved multi-core performance, and a new compiler option to enhance developer productivity.
Elixir v1.20 has been released, marking a significant milestone in the language’s evolution by introducing a gradual type system capable of type inference and checking without requiring explicit annotations. This development follows an initiative announced in 2022 to implement set-theoretic types, with an award-winning paper on the design published in June 2023 that signalled the shift from research to active development.
The new system enables the detection of dead code and verified bugs through a unique dynamic() type that supports both compatibility and narrowing. Unlike other gradual type systems that may use an any() type leading to unchecked violations, Elixir’s dynamic() type ensures that typing violations are only reported when supplied and accepted types are disjoint. This approach allows the language to identify bugs guaranteed to fail at runtime while maintaining an extremely low false positive rate.
Implementation of the type system was made possible through a partnership between CNRS and Remote, with current development work sponsored by Fresha and Tidewave. The system utilises basic set operations such as unions, intersections, and negations to describe types, ensuring the inferred types align with program behaviour. Elixir passes 12 of the 13 categories in the “If T: Benchmark for Type Narrowing”, demonstrating its ability to recover precise type information from ordinary code.
Beyond type checking, the release features improved compilation times, particularly on multi-core machines. Synthetic benchmarks now position Elixir’s build tool as the fastest among BEAM languages. A new compiler option, :module_definition, allows modules to be defined as :interpreted rather than :compiled, which may enhance performance in large projects without affecting the .beam files written to disk.
Looking ahead, the Elixir team plans to introduce typed struct definitions and type signatures, contingent on resolving remaining research and development challenges. The current release focuses on establishing a sound, developer-friendly foundation that integrates seamlessly into existing codebases, allowing developers to benefit from static analysis without immediate overhead.

