Programming with union, intersection, and negation types
Giuseppe Castagna

TL;DR
This paper advocates for set-theoretic types, including union, intersection, and negation, highlighting their necessity and advantages in programming language design and type safety.
Contribution
It introduces a theoretical framework for set-theoretic types, extends semantic subtyping with polymorphism, and proposes practical language restrictions for implementation.
Findings
Set-theoretic types are essential for precise typing of programming patterns.
Three effective language restrictions enable practical implementation of set-theoretic types.
The framework supports advanced features like pattern matching, gradual typing, and denotational semantics.
Abstract
In this essay, I present the advantages and, I dare say, the beauty of programming in a language with set-theoretic types, that is, types that include union, intersection, and negation type connectives. I show by several examples how set-theoretic types are necessary to type some common programming patterns, but also how they play a key role in typing several language constructs-from branching and pattern matching to function overloading and type-cases-very precisely. I start by presenting the theory of types known as semantic subtyping and extend it to include polymorphic types. Next, I discuss the design of languages that use these types. I start by defining a theoretical framework that covers all the examples given in the first part of the presentation. Since the system of the framework cannot be effectively implemented, I then describe three effective restrictions of this system:…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
