Department of Computer Science and Technology

Technical reports

Aliasing contracts: a dynamic approach to alias protection

Janina Voigt, Alan Mycroft

June 2013, 27 pages

DOI: 10.48456/tr-836

Abstract

Object-oriented programming languages allow multiple variables to refer to the same object, a situation known as aliasing. Aliasing is a powerful tool which enables sharing of objects across a system. However, it can cause serious encapsulation breaches if not controlled properly; through aliasing, internal parts of aggregate objects can be exposed and potentially modified by any part of the system.

A number of schemes for controlling aliasing have been proposed, including Clarke et al.’s ownership types and Boyland et al.’s capabilities. However, many existing systems lack flexibility and expressiveness, making it difficult in practice to program common idioms or patterns which rely on sharing, such as iterators.

We introduce aliasing contracts, a dynamic alias protection scheme which is highly flexible and expressive. Aliasing contracts allow developers to express assumptions about which parts of a system can access particular objects. Aliasing contracts attempt to be a universal approach to alias protection; they can be used to encode various existing schemes.

Full text

PDF (0.3 MB)

BibTeX record

@TechReport{UCAM-CL-TR-836,
  author =	 {Voigt, Janina and Mycroft, Alan},
  title = 	 {{Aliasing contracts: a dynamic approach to alias protection}},
  year = 	 2013,
  month = 	 jun,
  url = 	 {https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-836.pdf},
  institution =  {University of Cambridge, Computer Laboratory},
  doi = 	 {10.48456/tr-836},
  number = 	 {UCAM-CL-TR-836}
}