TitleA practical type system and language for reference immutability
Publication TypeConference Paper
Year of Publication2004
AuthorsBirka A, Ernst MD
Conference NameOOPSLA 2004, Object-Oriented Programming Systems, Languages, and Applications
Pagination35–49
Date or Month PublishedOctober
Conference LocationVancouver, BC, Canada
AbstractThis paper describes a type system that is capable of expressing and enforcing immutability constraints. The specific constraint expressed is that the abstract state of the object to which an immutable reference refers cannot be modified using that reference. The abstract state is (part of) the transitively reachable state: that is, the state of the object and all state reachable from it by following references. The type system permits explicitly excluding fields or objects from the abstract state of an object. For a statically type-safe language, the type system guarantees reference immutability. If the language is extended with immutability downcasts, then run-time checks enforce the reference immutability constraints. \par In order to better understand the usability and efficacy of the type system, we have implemented an extension to Java, called Javari, that includes all the features of our type system. Javari is interoperable with Java and existing JVMs. It can be viewed as a proposal for the semantics of the Java \textttconst keyword, though Javari's syntax uses \textttreadonly instead. This paper describes the design and implementation of Javari, including the type-checking rules for the language. This paper also discusses experience with 160,000 lines of Javari code. Javari was easy to use and provided a number of benefits, including detecting errors in well-tested code.
Downloadshttps://types.cs.washington.edu/javari/ Javari implementation https://homes.cs.washington.edu/~mernst/pubs/ref-immutability-oopsla2004... PDF https://homes.cs.washington.edu/~mernst/pubs/ref-immutability-oopsla2004... slides (PDF)
Citation KeyBirkaE2004