iDOT: A DOT calculus with object initialization
Loading...
Date
Authors
Journal Title
Journal ISSN
Volume Title
Publisher
University of Waterloo
Abstract
The Dependent Object Types (DOT) calculus serves as a foundation of the Scala programming language, with a machine-verified soundness proof. However, Scala's type system has been shown to be unsound due to null references, which are used as default values of fields of objects before they have been initialized.
This paper proposed iDOT, an extension of DOT for ensuring safe initialization of objects. DOT was previously extended to kDOT with the addition of mutable fields and constructors. To kDOT, iDOT adds an initialization effect system that statically prevents the possibility of reading a null reference from an uninitialized object. To design iDOT, we have reformulated the Freedom Before Commitment object initialization scheme in terms of disjoint subheaps to make it easier to formalize in an effect system and prove sound. Soundness of iDOT depends on the interplay of three systems of rules: a type system close to that of DOT, an effect system to ensure definite assignment of fields in each constructor, and an initialization system that tracks the initialization status of objects in a stack of subheaps. We have proven the overall system sound and verified the soundness proof using the Coq proof assistant.