Safe type checking in a statically-typed object-oriented programming language

In this paper we introduce a statically-typed, functional, object-oriented programming language, TOOPL, which supports classes, objects, methods, instance variable, subtypes, and inheritance. It has proved to be surprisingly difficult to design statically-typed object-oriented languages which are nearly as expressive as Smalltalk and yet have no holes in their typing systems. A particular problem with statically type checking object-oriented languages is determining whether a method provided in a superclass will continue to type check when inherited in a subclass. This program is solved in our language by providing type checking rules which guarantee that a method which type checks as part of a class will type check correctly in all legal subclasses in which it is inherited. This feature enables library providers to provide only the interfaces of classes with executables and still allow users to safely create subclasses. The design of TOOPL has been guided by an analysis of the semantics of the language, which is given in terms of a sufficiently rich model of the F-bounded second-order lambda calculus. This semantics supported the language design by providing a means of proving that the type-checking rules for the language are sound, ensuring that well-typed terms produce objects of the appropriate type. In particular, in a well-typed program it is impossible to send a message to an object which lacks a corresponding method.

[1]  John C. Mitchell,et al.  F-bounded polymorphism for object-oriented programming , 1989, FPCA.

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

[3]  Craig Schaffert,et al.  An introduction to Trellis/Owl , 1986, OOPLSA '86.

[4]  Luca Cardelli,et al.  Extensible records in a pure calculus of subtyping , 1994 .

[5]  Luca Cardelli,et al.  A Semantics of Multiple Inheritance , 1984, Information and Computation.

[6]  Jens Palsberg,et al.  Efficient recursive subtyping , 1992, POPL '93.

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

[8]  William R. Cook,et al.  Interfaces for strongly-typed object-oriented programming , 1989, OOPSLA 1989.

[9]  William R. Cook,et al.  A Proposal for Making Eiffel Type-Safe , 1989, Comput. J..

[10]  Craig Schaffert,et al.  An introduction to Trellis/Owl , 1986, OOPSLA 1986.

[11]  John C. Mitchell,et al.  Abstract types have existential type , 1988, TOPL.

[12]  John C. Reynolds,et al.  Towards a theory of type structure , 1974, Symposium on Programming.

[13]  Luca Cardelli,et al.  Typed Foundations of Object-oriented Programming , 1994 .

[14]  Kim B. Bruce A paradigmatic object-oriented programming language: Design, static typing and semantics , 1994, Journal of Functional Programming.

[15]  Luca Cardelli,et al.  Structural subtyping and the notion of power type , 1988, POPL '88.

[16]  Benjamin C. Pierce,et al.  Object-oriented programming without recursive types , 1993, POPL '93.

[17]  Giorgio Ghelli,et al.  Coherence of Subsumption, Minimum Typing and Type-Checking in F<= , 1992, Math. Struct. Comput. Sci..

[18]  Bertrand Meyer,et al.  Eiffel: The Language , 1991 .

[19]  Benjamin C. Pierce,et al.  Bounded quantification is undecidable , 1992, POPL '92.

[20]  John C. Mitchell,et al.  F-bounded quantification for object-oriented programming , 1989 .

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

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

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

[24]  John C. Mitchell,et al.  PER models of subtyping, recursive types and higher-order polymorphism , 1992, POPL '92.

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

[26]  Ralph E. Johnson,et al.  A type system for Smalltalk , 1989, POPL '90.

[27]  Luca Cardelli,et al.  Subtyping recursive types , 1991, POPL '91.

[28]  Luca Cardelli,et al.  Operations on Records , 1989, Mathematical Foundations of Programming Semantics.

[29]  Luca Cardelli,et al.  A Semantic Basis for Quest , 1991, J. Funct. Program..

[30]  Luca Cardelli,et al.  Modula-3 Report. , 1988 .