A simple blame calculus for explicit nulls
Abstract Gradual typing provides a model for when a legacy language with less precise types interacts with a newer language with more precise types. Casts mediate between types of different precision, allocating blame when a value fails to conform to a type. The blame theorem asserts that blame always falls on the less-precisely typed side of a cast. One instance of interest is when a legacy language (such as Java) permits null values at every type, while a newer language (such as Scala or Kotlin) explicitly indicates which types permit null values. Nieto et al. in 2020 introduced a gradually typed calculus for just this purpose. The calculus requires three distinct constructors for function types and a non-standard proof of the blame theorem; it can embed terms from the legacy language into the newer language (or vice versa) only when they are closed. Here, we define a simpler calculus that is more orthogonal, with one constructor for function types and one for possibly nullable types, and with an entirely standard proof of the blame theorem; it can embed terms from the legacy language into the newer language (and vice versa) even if they are open. All results in the paper have been mechanized in Coq.
Authors
- Philip Wadler (ORCID: https://orcid.org/0000-0001-7619-6378)
- Ondřej Lhoták (ORCID: https://orcid.org/0000-0001-9066-1889)
Institutions
- University of Waterloo (CA)
- University of Edinburgh (GB)
Publication Details
- Journal
- Journal of Functional Programming
- Published
- 2024-12-27
- DOI
- https://doi.org/10.1017/s0956796824000121
- Primary Topic
- Logic, programming, and type systems
- Type
- article
- Field-Weighted Citation Impact
- 0.00