License: Creative Commons Attribution 3.0 Unported license (CC BY 3.0)
When quoting this document, please refer to the following
DOI: 10.4230/LIPIcs.ECOOP.2020.25
URN: urn:nbn:de:0030-drops-131821
URL: http://dagstuhl.sunsite.rwth-aachen.de/volltexte/2020/13182/
Nieto, Abel ;
Zhao, Yaoyu ;
Lhoták, Ondřej ;
Chang, Angela ;
Pu, Justin
Scala with Explicit Nulls
Abstract
The Scala programming language makes all reference types implicitly nullable. This is a problem, because null references do not support most operations that do make sense on regular objects, leading to runtime errors. In this paper, we present a modification to the Scala type system that makes nullability explicit in the types. Specifically, we make reference types non-nullable by default, while still allowing for nullable types via union types. We have implemented this design for explicit nulls as a fork of the Dotty (Scala 3) compiler. We evaluate our scheme by migrating a number of Scala libraries to use explicit nulls. Finally, we give a denotational semantics of type nullification, the interoperability layer between Java and Scala with explicit nulls. We show a soundness theorem stating that, for variants of System F_ω that model Java and Scala, nullification preserves values of types.
BibTeX - Entry
@InProceedings{nieto_et_al:LIPIcs:2020:13182,
author = {Abel Nieto and Yaoyu Zhao and Ondřej Lhot{\'a}k and Angela Chang and Justin Pu},
title = {{Scala with Explicit Nulls}},
booktitle = {34th European Conference on Object-Oriented Programming (ECOOP 2020)},
pages = {25:1--25:26},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
ISBN = {978-3-95977-154-2},
ISSN = {1868-8969},
year = {2020},
volume = {166},
editor = {Robert Hirschfeld and Tobias Pape},
publisher = {Schloss Dagstuhl--Leibniz-Zentrum f{\"u}r Informatik},
address = {Dagstuhl, Germany},
URL = {https://drops.dagstuhl.de/opus/volltexte/2020/13182},
URN = {urn:nbn:de:0030-drops-131821},
doi = {10.4230/LIPIcs.ECOOP.2020.25},
annote = {Keywords: Scala, Java, nullability, language interoperability, type systems}
}
Keywords: |
|
Scala, Java, nullability, language interoperability, type systems |
Collection: |
|
34th European Conference on Object-Oriented Programming (ECOOP 2020) |
Issue Date: |
|
2020 |
Date of publication: |
|
06.11.2020 |
Supplementary Material: |
|
ECOOP 2020 Artifact Evaluation approved artifact available at https://doi.org/10.4230/DARTS.6.2.14. |