Back to Search
Start Over
A practical type system and language for reference immutability
- Source :
- OOPSLA
- Publication Year :
- 2004
- Publisher :
- ACM, 2004.
-
Abstract
- 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.
- Subjects :
- Immutability
Object-oriented programming
Theoretical computer science
Syntax (programming languages)
Java
Semantics (computer science)
Programming language
Computer science
Semantics
computer.software_genre
Object (computer science)
Computer Graphics and Computer-Aided Design
Data type
State (computer science)
computer
Software
computer.programming_language
Subjects
Details
- Database :
- OpenAIRE
- Journal :
- Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
- Accession number :
- edsair.doi.dedup.....5691508f899178a982cbba7e9ff7091b