Download: PDF, slides (PDF), Javari implementation.
“A practical type system and language for reference immutability” by Adrian Birka and Michael D. Ernst. In OOPSLA 2004, Object-Oriented Programming Systems, Languages, and Applications, (Vancouver, BC, Canada), Oct. 2004, pp. 35-49.
This 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.
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 const
keyword, though Javari's syntax uses
readonly
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.
Download: PDF, slides (PDF), Javari implementation.
BibTeX entry:
@inproceedings{BirkaE2004, author = {Adrian Birka and Michael D. Ernst}, title = {A practical type system and language for reference immutability}, booktitle = {OOPSLA 2004, Object-Oriented Programming Systems, Languages, and Applications}, pages = {35--49}, address = {Vancouver, BC, Canada}, month = oct, year = {2004} }