HackerPapers

arXiv:2306.06391cs.PL

The Design Principles of the Elixir Type System

Giuseppe Castagna, Guillaume Duboc, José Valim

Abstract

Elixir is a dynamically-typed functional language running on the Erlang Virtual Machine, designed for building scalable and maintainable applications. Its characteristics have earned it a surging adoption by hundreds of industrial actors and tens of thousands of developers. Static typing seems nowadays to be the most important request coming from the Elixir community. We present a gradual type system we plan to include in the Elixir compiler, outline its characteristics and design principles, and show by some short examples how to use it in practice. Developing a static type system suitable for Erlang's family of languages has been an open research problem for almost two decades. Our system transposes to this family of languages a polymorphic type system with set-theoretic types and semantic subtyping. To do that, we had to improve and extend both semantic subtyping and the typing techniques thereof, to account for several characteristics of these languages -- and of Elixir in particular -- such as the arity of functions, the use of guards, a uniform treatment of records and dictionaries, the need for a new sound gradual typing discipline that does not rely on the insertion at compile time of specific run-time type-tests but, rather, takes into account both the type tests performed by the virtual machine and those explicitly added by the programmer. The system presented here is "gradually" being implemented and integrated in Elixir, but a prototype implementation is already available. The aim of this work is to serve as a longstanding reference that will be used to introduce types to Elixir programmers, as well as to hint at some future directions and possible evolutions of the Elixir language.

arXiv comments
Journal reference
The Art, Science, and Engineering of Programming, 2024, Vol. 8, Issue 2, Article 4
DOI
doi:10.22152/programming-journal.org/2024/8/4
Subjects
cs.PLProgramming Languages

On Hacker News

Linked by 5 identifiable commenters in 5 comments across 5 threads, from Sep 2023 to Nov 2025. Found in 3 HN submissions from Sep 2023 to Jun 2026. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments5 threads

    • > its not just the lack of types altogether ?? Elixir is strongly but dynamically typed. On the progress of static typing: https://arxiv.org/abs/2306.06391

      baobunView on HNParent context

    • And with Elixir's gradual type system [1] coming soon, this is looking to be quite an eventful year for José and Team. Bravo! [1] https://arxiv.org/abs/2306.06391

      djaouenView on HNParent context

  1. Elixir at Ramp 1 comment
    • > The hottest news in the Elixir community is that it is currently experimenting with set theoretic type / gradual typing. Some french PHD is working on it To expand on it: you can read the proposal[0] or watch the video presentation by the author[1]. It is a very similar system…

      pzmarzlyView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.