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.

Details

Title
A simple blame calculus for explicit nulls
Author
LHOTÁK, ONDŘEJ 1   VIAFID ORCID Logo  ; Wadler, Philip 2   VIAFID ORCID Logo 

 University of Waterloo, Waterloo, Canada (e-mail: [email protected]
 School of Informatics, University of Edinburgh, Edinburgh, UK (e-mail: [email protected]
Publication year
2024
Publication date
Dec 2024
Publisher
Cambridge University Press
ISSN
09567968
e-ISSN
14697653
Source type
Scholarly Journal
Language of publication
English
ProQuest document ID
3149298078
Copyright
© The Author(s), 2025. Published by Cambridge University Press. This work is licensed under the Creative Commons Attribution License This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited. (the “License”). Notwithstanding the ProQuest Terms and Conditions, you may use this content in accordance with the terms of the License.