Affiliation:
1. Aarhus University, Denmark
Abstract
We present a simple, practical, and expressive relational nullable type system. A relational nullable type system captures whether an expression may evaluate to null based on its type, but also based on the type of other related expressions. The type system extends the Hindley-Milner type system with Boolean constraints, supports parametric polymorphism, and preserves principal types modulo Boolean equivalence. We show how to support full Hindley-Milner style type inference with an extension of Algorithm W.
We conduct a preliminary study of open source projects showing that there is a need for relational nullable type systems across a wide range of programming languages. The most important findings from the study are: (i) programmers use programming patterns where the nullability of one expression depends on the nullability of other related expressions, (ii) such invariants are commonly enforced with run-time exceptions, and (iii) reasoning about these programming patterns requires not only knowledge of when an expression may evaluate to null, but also when it may evaluate to a non-null value. We incorporate these observations in the design of the proposed relational nullable type system.
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference37 articles.
1. On the Complexity of Boolean Unification. Inform;Baader Franz;Process. Lett..,1998
2. George Boole. 1847. The mathematical analysis of logic. George Boole. 1847. The mathematical analysis of logic.
3. Unification in Boolean Rings and Abelian Groups;Boudet Alexandre;Journal of Symbolic Computation.,1989
Cited by
4 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Qualifying System F
<:
: Some Terms and Conditions May Apply;Proceedings of the ACM on Programming Languages;2024-04-29
2. Fast and Efficient Boolean Unification for Hindley-Milner-Style Type and Effect Systems;Proceedings of the ACM on Programming Languages;2023-10-16
3. With or Without You: Programming with Effect Exclusion;Proceedings of the ACM on Programming Languages;2023-08-30
4. The Principles of the Flix Programming Language;Proceedings of the 2022 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software;2022-11-29