Type systems for object-oriented programming languages

Object-oriented programming languages (OOPL's) provide important support for today's large-scale software projects. Unfortunately, typed OOPL's, such as Simula and C++, have suffered from overly restrictive type systems. Among other things, the rigidity of these systems force programmers to use type-casts to achieve flexibility, a notorious source of hard-to-find bugs. These restrictive type systems also mean that programming idioms common to untyped OOPL's, such as Smalltalk, are not typeable. One source of this inflexibility is the conflation of subtyping and inheritance. Briefly, inheritance is an implementation technique in which new object definitions are given as incremental modifications to existing ones. Subtyping concerns substitutivity: when can one object safely replace another? By tying subtyping to inheritance, existing OOPL's reduce the number of legal substitutions in a system and hence their degree of polymorphism. Attempts to fix this rigidity have resulted in unsound type systems, most notably Eiffel's. This thesis develops a sound type system for a formal object-oriented language that addresses this lack. It gains flexibility by separating subtyping and inheritance. It also supports method specialization, which means that the types of methods may be refined in certain ways during inheritance. The lack of such a mechanism is one of the key sources of type-casts in languages like C++ and Object Pascal. Abstraction primitives in this formal language support a class construct similar to the one found in C++, Eiffel, and Java. This study explains the link between inheritance and subtyping: object types that include implementation information are a form of abstract type, and the only way to produce a subtype of an abstract type is via extension, (i.e., by inheritance). The study also suggests that object primitives and encapsulation are orthogonal language features that together produce an object-oriented language. Hence, adding object primitives to a language that supports encapsulation (such as ML) should be sufficient to create an object-oriented language. Formally, the language is presented as an object calculus and a type system with row variables, variance annotations, method-absence annotations, and abstract types. The thesis proves type soundness with respect to an operational semantics via a subject reduction theorem.

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

[2]  Luca Cardelli,et al.  Operations on records , 1989, Mathematical Structures in Computer Science.

[3]  H. Lipkin Where is the ?c? , 1978 .

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

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

[6]  Grady Booch,et al.  Object-Oriented Design with Applications , 1990 .

[7]  Martin Hofmann,et al.  Positive subtyping , 1995, POPL '95.

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

[9]  Adriana B. Compagnoni,et al.  Higher-order subtyping with intersection types , 1995 .

[10]  Martín Abadi,et al.  A Theory of Objects , 1996, Monographs in Computer Science.

[11]  Martín Abadi,et al.  An Imperative Object Calculus , 1995, TAPSOFT.

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

[13]  William R. Cook,et al.  A denotational semantics of inheritance , 1989 .

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

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

[16]  Giuseppe Castagna,et al.  A Calculus for Overloaded Functions with Subtyping , 1995, Inf. Comput..

[17]  William R. Cook,et al.  A self-ish model of inheritance , 1987 .

[18]  Benjamin C. Pierce,et al.  Statically typed friendly functions via partially abstract types , 1993 .

[19]  Luca Cardelli,et al.  A language with distributed scope , 1995, POPL '95.

[20]  Luca Cardelli,et al.  The Modula–3 type system , 1989, POPL '89.

[21]  Jean D. etc. Ichbiah Reference Manual for the ADA Programming Language , 1983 .

[22]  Luigi Liquori,et al.  A Subtyping for the Fisher-Honsell-Mitchell Lambda Calculus of Objects , 1994, CSL.

[23]  David C. Luckham,et al.  A new approach to prototyping Ada-based hardware/software systems , 1990, TRI-Ada '90.

[24]  Gary T. Leavens,et al.  Typechecking and modules for multi-methods , 1994, OOPSLA '94.

[25]  Edsger W. Dijkstra,et al.  Notes on structured programming , 1970 .

[26]  Ken Arnold,et al.  The Java Programming Language , 1996 .

[27]  Giuseppe Castagna,et al.  A calculus for overloaded functions with subtyping , 1992, LFP '92.

[28]  John C. Mitchell,et al.  Polymorphism and Subtyping in Interfaces , 1994, Workshop on Interface Definition Languages.

[29]  Jonathan Rees,et al.  T: a dialect of Lisp or LAMBDA: The ultimate software tool , 1982, LFP '82.

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

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

[32]  John H. Reppy,et al.  Classes in Object ML via Modules , 1996 .

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

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

[35]  Greg Nelson,et al.  Systems programming in modula-3 , 1991 .

[36]  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.

[37]  Jonathan Rees,et al.  Object-oriented programming in scheme , 1988, LFP '88.

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

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

[40]  Martín Abadi,et al.  Baby Modula-3 and a theory of objects , 1994, Journal of Functional Programming.

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

[42]  John C. Mitchell,et al.  A type system for prototyping languages , 1994, POPL '94.

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

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

[45]  John C. Mitchell,et al.  An extension of standard ML modules with subtyping and inheritance , 1991, POPL '91.

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

[47]  Scott F. Smith,et al.  Sound polymorphic type inference for objects , 1995, OOPSLA.

[48]  Kim B. Bruce The Equivalence of Two Semantic Definitions for Inheritance in Object-Oriented Languages , 1991, MFPS.

[49]  Randall B. Smith,et al.  SELF: The power of simplicity , 1987, OOPSLA '87.

[50]  Craig Schaffert,et al.  CLU Reference Manual , 1984, Lecture Notes in Computer Science.

[51]  John C. Mitchell,et al.  The Development of Type Systems for Object-Oriented Languages , 1995, Theory Pract. Object Syst..

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

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

[54]  William R. Cook,et al.  Inheritance is not subtyping , 1989, POPL '90.