Title
A type system for borrowing permissions
Abstract
In object-oriented programming, unique permissions to object references are useful for checking correctness properties such as consistency of typestate and noninterference of concurrency. To be usable, unique permissions must be borrowed --- for example, one must be able to read a unique reference out of a field, use it for something, and put it back. While one can null out the field and later reassign it, this paradigm is ungainly and requires unnecessary writes, potentially hurting cache performance. Therefore, in practice borrowing must occur in the type system, without requiring memory updates. Previous systems support borrowing with external alias analysis and/or explicit programmer management of fractional permissions. While these approaches are powerful, they are also awkward and difficult for programmers to understand. We present an integrated language and type system with unique, immutable, and shared permissions, together with new local permissions that say that a reference may not be stored to the heap. Our system also includes change permissions such as uniqueunique and uniquenone that describe how permissions flow in and out of method formal parameters. Together, these features support common patterns of borrowing, including borrowing multiple local permissions from a unique reference and recovering the unique reference when the local permissions go out of scope, without any explicit management of fractions in the source language. All accounting of fractional permissions is done by the type system "under the hood." We present the syntax and static and dynamic semantics of a formal core language and state soundness results. We also illustrate the utility and practicality of our design by using it to express several realistic examples.
Year
DOI
Venue
2012
10.1145/2103656.2103722
POPL
Keywords
Field
DocType
borrowing multiple local permission,permissions flow,fractional permission,borrowing permission,integrated language,practice borrowing,formal core language,previous system,type system,unique reference,unique permission,alias analysis,object oriented programming
Programming language,Programmer,Computer science,Cache,Concurrency,Correctness,Heap (data structure),Alias analysis,Soundness,Semantics
Conference
Volume
Issue
ISSN
47
1
0362-1340
Citations 
PageRank 
References 
20
0.70
19
Authors
4
Name
Order
Citations
PageRank
Karl Naden1483.03
Robert Bocchino2362.23
Jonathan Aldrich3107677.64
Kevin Bierhoff41708.61