🤖 AI Summary
To address the lack of high-precision static typing in the dynamically typed functional language Elixir, this paper proposes a progressive semantic subtyping system that requires no modifications to the compiler or runtime. Methodologically, it introduces the first strong static function identification mechanism, integrating fine-grained type inference—based on guard condition modeling and pattern matching—with formalized runtime checks within semantic subtyping theory; type checking is achieved non-intrusively and with zero migration overhead. The key contribution is the first support for high-precision type inference under semantic subtyping constraints within the Elixir ecosystem: it achieves full backward compatibility while significantly improving type coverage and safety. This work establishes a reusable theoretical framework and engineering paradigm for progressive typing in dynamic languages.
📝 Abstract
We define several techniques to extend gradual typing with semantic subtyping, specifically targeting dynamic languages. Focusing on the Elixir programming language, we provide the theoretical foundations for its type system. Our approach demonstrates how to achieve type soundness for gradual typing in existing dynamic languages without modifying their compilation, while still maintaining high precision. This is accomplished through the static detection of"strong functions", which leverage runtime checks inserted by the programmer or performed by the virtual machine, and through a fine-grained type analysis of pattern-matching expressions with guards.