Ownership types for object encapsulation

Ownership types provide a statically enforceable way of specifying object encapsulation and enable local reasoning about program correctness in object-oriented languages. However, a type system that enforces strict object encapsulation is too constraining: it does not allow efficient implementation of important constructs like iterators. This paper argues that the right way to solve the problem is to allow objects of classes defined in the same module to have privileged access to each other's representations; we show how to do this for inner classes. This approach allows programmers to express constructs like iterators and yet supports local reasoning about the correctness of the classes, because a class and its inner classes together can be reasoned about as a module. The paper also sketches how we use our variant of ownership types to enable efficient software upgrades in persistent object stores.

[1]  Andrew C. Myers,et al.  Subtypes vs. where clauses: constraining parametric polymorphism , 1995, OOPSLA.

[2]  David Walker,et al.  Typed memory management in a calculus of capabilities , 1999, POPL '99.

[3]  Craig Chambers,et al.  Alias annotations for program understanding , 2002, OOPSLA '02.

[4]  Michael I. Schwartzbach,et al.  The pointer assertion logic engine , 2000, PLDI '01.

[5]  James Noble,et al.  Iterators and encapsulation , 2000, Proceedings 33rd International Conference on Technology of Object-Oriented Languages and Systems TOOLS 33.

[6]  Martin C. Rinard,et al.  ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), November 2002 Ownership Types for Safe Programming: Preventing Data Races and Deadlocks , 2022 .

[7]  Craig Schaffert,et al.  Abstraction mechanisms in CLU , 1977, Commun. ACM.

[8]  A. Nico Habermann,et al.  Beyond schema evolution to database reorganization , 1990, OOPSLA/ECOOP '90.

[9]  Philip Wadler,et al.  Linear Types can Change the World! , 1990, Programming Concepts and Methods.

[10]  J. J. Horning,et al.  Report on the programming language Euclid , 1977, SIGP.

[11]  Anindya Banerjee,et al.  Representation independence, confinement and access control [extended abstract] , 2002, POPL '02.

[12]  Miguel Castro,et al.  Providing Persistent Objects in Distributed Systems , 1999, ECOOP.

[13]  Martin Rinard,et al.  Safe Runtime Downcasts With Ownership Types , 2002 .

[14]  Robert DeLine,et al.  Enforcing high-level protocols in low-level software , 2001, PLDI '01.

[15]  David K. Gifford,et al.  Polymorphic effect systems , 1988, POPL '88.

[16]  Richard C. Holt,et al.  The Geneva convention on the treatment of object aliasing , 1992, OOPS.

[17]  Martin Rinard,et al.  A Type System for Safe Region-Based Memory Management in Real-Time Java , 2002 .

[18]  Greg Nelson,et al.  Wrestling with rep exposure , 1998 .

[19]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[20]  Naftaly H. Minsky Towards Alias-Free Pointers , 1996, ECOOP.

[21]  Stephen N. Freund,et al.  Adding type parameterization to the Java language , 1997, OOPSLA '97.

[22]  Liuba Shrira,et al.  Safe Lazy Software Upgrades in Object-Oriented Databases , 2002 .

[23]  Paulo Sérgio Almeida Balloon Types: Controlling Sharing of State in Data Types , 1997, ECOOP.

[24]  James Noble,et al.  Ownership types for flexible alias protection , 1998, OOPSLA '98.

[25]  Liuba Shrira,et al.  Ownership Types and Safe Lazy Upgrades in Object-Oriented Databases , 2002 .

[26]  James Cheney,et al.  Region-based memory management in cyclone , 2002, PLDI '02.

[27]  Martin C. Rinard,et al.  A parameterized type system for race-free Java programs , 2001, OOPSLA '01.

[28]  Mirko Viroli,et al.  Parametric polymorphism in Java: an approach to translation based on reflective features , 2000, OOPSLA '00.

[29]  Nils Klarlund,et al.  Graph types , 1993, POPL '93.

[30]  K. Rustan M. Leino,et al.  Data groups: specifying the modification of extended state , 1998, OOPSLA '98.

[31]  Malcolm P. Atkinson,et al.  Scalable and Recoverable Implementation of Object Evolution for the PJama1 Platform , 2000, POS.

[32]  Jan Vitek,et al.  Confined types , 1999, OOPSLA '99.

[33]  David Maier,et al.  The GemStone Data Management System , 1989, Object-Oriented Concepts, Databases, and Applications.

[34]  Stephen N. Freund,et al.  Type-based race detection for Java , 2000, PLDI '00.

[35]  Martin Odersky,et al.  Making the future safe for the past: adding genericity to the Java programming language , 1998, OOPSLA '98.

[36]  Liuba Shrira,et al.  Lazy modular upgrades in persistent object stores , 2003, OOPSLA '03.

[37]  Reinhard Wilhelm,et al.  Solving shape-analysis problems in languages with destructive updating , 1998, TOPL.

[38]  Tobias Wrigstad,et al.  External Uniqueness , 2003 .

[39]  Mads Tofte,et al.  Region-based Memory Management , 1997, Inf. Comput..

[40]  Sophia Drossopoulou,et al.  Ownership, encapsulation and the disjointness of type and effect , 2002, OOPSLA '02.

[41]  Ole Lehrmann Madsen,et al.  Object-oriented programming in the BETA programming language , 1993 .

[42]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[43]  Jay Banerjee,et al.  Semantics and implementation of schema evolution in object-oriented databases , 1987, SIGMOD '87.

[44]  James Noble,et al.  Simple Ownership Types for Object Containment , 2001, ECOOP.

[45]  Aaron Greenhouse,et al.  An Object-Oriented Effects System , 1999, ECOOP.

[46]  Viktor Kuncak,et al.  Role analysis , 2002, POPL '02.

[47]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..

[48]  Matthias Felleisen,et al.  Classes and mixins , 1998, POPL '98.

[49]  Peter M Uller,et al.  Universes: a type system for controlling representation exposure , 1999 .

[50]  K. Rustan M. Leino,et al.  Data abstraction and information hiding , 2002, TOPL.

[51]  Andrew C. Myers,et al.  Parameterized types for Java , 1997, POPL '97.

[52]  Robert DeLine,et al.  Adoption and focus: practical linear types for imperative programming , 2002, PLDI '02.

[53]  Martin C. Rinard,et al.  Ownership types for safe region-based memory management in real-time Java , 2003, PLDI '03.

[54]  Jacob Stein,et al.  Class modification in the GemStone object-oriented DBMS , 1987, OOPSLA '87.

[55]  John Hogg,et al.  Islands: aliasing protection in object-oriented languages , 1991, OOPSLA '91.

[56]  Chandrasekhar Boyapati,et al.  JPS : a distributed persistent Java system , 1998 .

[57]  O. Deux,et al.  The Story of O2 , 1990, IEEE Trans. Knowl. Data Eng..

[58]  K. Rustan M. Leino,et al.  Using data groups to specify and check side effects , 2002, PLDI '02.

[59]  R. Connor,et al.  Design Issues for Persistent Java: a type-safe, object-oriented, orthogonally persistent system , 1996 .

[60]  David J. DeWitt,et al.  Shoring up persistent applications , 1994, SIGMOD '94.

[61]  David Gerard Clarke,et al.  Object ownership and containment , 2003 .