Classes = Objects + Data Abstraction

We describe a type-theoretic foundation for object systems that include ``interface types'''' and ``implementation types.'''' Our approach begins with a basic object calculus that provides a notion of object, method lookup, and object extension (an object-based form of inheritance). In this calculus, the type of an object gives its interface, as a set of methods and their types, but does not imply any implementation properties. We extend this object calculus with a higher-order form of data abstraction that allows us to declare supertypes of an abstract type and a list of methods guaranteed not to be present. This results in a flexible framework for studying and improving practical programming languages where the type of an object gives certain implementation guarantees, such as would be needed to statically determine the offset of a method or safely implement binary operations without exposing the internal representation of objects. We prove type soundness for the entire language using operational semantics and an analysis of typing derivations. One insight that is an immediate consequences of our analysis is a principled, type-theoretic explanation (for the first time, as far as we know) of the link between subtyping and inheritance in C++, Eiffel and related languages.

[1]  John C. Mitchell Toward a typed foundation for method specialization and inheritance , 1989, POPL '90.

[2]  John C. Mitchell,et al.  On the Equivalence of Data Representations , 1991, Artificial and Mathematical Theory of Computation.

[3]  Benjamin C. Pierce,et al.  Simple type-theoretic foundations for object-oriented programming , 1994, Journal of Functional Programming.

[4]  John C. Mitchell,et al.  Notes on Typed Object-Oriented Programming , 1994, TACS.

[5]  John C. Mitchell,et al.  A Delegation-based Object Calculus with Subtying , 1995, FCT.

[6]  David Robson,et al.  Smalltalk-80: The Language and Its Implementation , 1983 .

[7]  Bjarne Stroustrup,et al.  The Annotated C++ Reference Manual , 1990 .

[8]  William R. Cook,et al.  Interfaces and specifications for the Smalltalk-80 collection classes , 1992, OOPSLA.

[9]  John C. Mitchell,et al.  Abstract types have existential types , 1985, POPL.

[10]  Mark Lillibridge,et al.  A type-theoretic approach to higher-order modules with sharing , 1994, POPL '94.

[11]  Luca Cardelli,et al.  Abstract Types and the Dot Notation , 1990, Programming Concepts and Methods.

[12]  Alan Snyder Encapsulation and inheritance in object-oriented programming languages , 1986, OOPSLA 1986.

[13]  Peter Buneman,et al.  Theoretical Aspects of Object-Oriented Programming , 1994 .

[14]  WegnerPeter,et al.  On understanding types, data abstraction, and polymorphism , 1985 .

[15]  John C. Mitchell,et al.  A lambda calculus of objects and method specialization , 1993, [1993] Proceedings Eighth Annual IEEE Symposium on Logic in Computer Science.

[16]  Kim B. Bruce Safe type checking in a statically-typed object-oriented programming language , 1993, POPL '93.

[17]  Luca Cardelli,et al.  On understanding types, data abstraction, and polymorphism , 1985, CSUR.

[18]  Bjarne Stroustrup,et al.  C++ Programming Language , 1986, IEEE Softw..

[19]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.

[20]  Martín Abadi,et al.  A Theory of Primitive Objects - Untyped and First-Order Systems , 1994, TACS.

[21]  Martín Abadi,et al.  A Theory of Primitive Objects: Second-Order Systems , 1995, Sci. Comput. Program..