A case for DOT: Theoretical Foundations for Objects With Pattern Matching and GADT-style Reasoning
Aleksander Boruch-Gruszecki, Rados{\l}aw Wa\'sko, Yichen Xu, Lionel, Parreaux

TL;DR
This paper introduces cDOT, a formal calculus based on Dependent Object Types, to provide a theoretical foundation for subtyping reconstruction in pattern matching on objects, addressing type errors in modern OO languages.
Contribution
The paper presents cDOT, a new calculus that formalizes subtyping reconstruction, enabling better handling of pattern matching on generic class hierarchies in object-oriented languages.
Findings
cDOT can encode advanced OO features like generics and recursive modules.
Subtyping reconstruction in cDOT subsumes GADTs.
Encoding of GADT calculus into cDOT demonstrates its expressiveness.
Abstract
Many programming languages in the OO tradition now support pattern matching in some form. Historical examples include Scala and Ceylon, with the more recent additions of Java, Kotlin, TypeScript, and Flow. But pattern matching on generic class hierarchies currently results in puzzling type errors in most of these languages. Yet this combination of features occurs naturally in many scenarios, such as when manipulating typed ASTs. To support it properly, compilers need to implement a form of subtyping reconstruction: the ability to reconstruct subtyping information uncovered at runtime during pattern matching. We introduce cDOT, a new calculus in the family of Dependent Object Types (DOT) intended to serve as a formal foundation for subtyping reconstruction. Being descended from pDOT, itself a formal foundation for Scala, cDOT can be used to encode advanced object-oriented features such…
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.
Taxonomy
TopicsLogic, programming, and type systems · Model-Driven Software Engineering Techniques · Advanced Software Engineering Methodologies
