The Design Rules of the Elixir Sort System
Giuseppe Castagna , Guillaume Duboc
, and José Valim
The Artwork, Science, and Engineering of Programming, 2024, Vol. 8, Subject 2, Article 4
Submission date: 2023-05-31
Publication date: 2023-10-15
DOI: https://doi.org/10.22152/programming-journal.org/2024/8/4
Full textual content: PDF
Summary
Elixir is a dynamically-typed purposeful language working on the Erlang Digital Machine, designed for constructing scalable and maintainable functions. Its traits have earned it a surging adoption by a whole lot of business actors and tens of 1000’s of builders. Static typing appears these days to be crucial request coming from the Elixir group. We current a gradual kind system we plan to incorporate within the Elixir compiler, define its traits and design rules, and present by some brief examples learn how to use it in apply.
Creating a static kind system appropriate for Erlang’s household of languages has been an open analysis downside for nearly 20 years. Our system transposes to this household of languages a polymorphic kind system with set-theoretic sorts and semantic subtyping. To do this, we had to enhance and lengthen each semantic subtyping and the typing methods thereof, to account for a number of traits of those languages—and of Elixir specifically—such because the arity of capabilities, the usage of guards, a uniform remedy of data and dictionaries, the necessity for a brand new sound gradual typing self-discipline that doesn’t depend on the insertion at compile time of particular run-time type-tests however, slightly, takes under consideration each the sort checks carried out by the digital machine and people explicitly added by the programmer.
The system offered right here is “progressively” being carried out and built-in in Elixir, however a prototype implementation is already accessible.
The purpose of this work is to function a longstanding reference that might be used to introduce sorts to Elixir programmers, in addition to to trace at some future instructions and potential evolutions of the Elixir language.