Typing in object-oriented languages: Achieving expressiveness and safety

While simple static-typing disciplines exist for object-oriented languages like C++, Java, and Object Pascal, they are often so innexible that programmers are forced to use type casts to get around the restrictions. At the other extreme are languages like Beta and Eiiel, which allow more freedom, but require run-time or link-time checking to pick up the type errors that their type systems are unable to detect at compile time. This paper presents a collection of sample programs which illustrate problems with existing type systems, and suggests ways of improving the expressiveness of these systems while retaining static type safety. In particular we will discuss the motivations behind introducing \MyType", \matching", and \match-bounded polymorphism" into these type systems. We also suggest a way of simplifying the resulting type system by replacing subtyping by a type system with a new type construct based on matching. Both systems provide for binary methods, which are often diicult to support properly in statically-typed languages. The intent is to explain why the problems are interesting via the series of sample programs, rather than getting bogged down with pages of type-checking rules and formal proofs. The technical details (including proofs of type safety) are available elsewhere.

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

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

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

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

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

[6]  Andrew P. Black,et al.  Object structure in the Emerald system , 1986, OOPSLA 1986.

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

[8]  Bent Bruun Kristensen,et al.  The BETA Programming Language , 1987, Research Directions in Object-Oriented Programming.

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

[10]  Bjarne Stroustrup,et al.  The C++ Programming Language, First Edition , 1986 .

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

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

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

[14]  Larry Carter,et al.  Distrbution and Abstract Types in Emerald , 1987, IEEE Transactions on Software Engineering.

[15]  Scott Danforth,et al.  Type theories and object-oriented programmimg , 1988, CSUR.

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

[17]  Kim B. Bruce,et al.  PolyTOIL: A Type-Safe Polymorphic Object-Oriented Language , 1995, ECOOP.

[18]  Martín Abadi,et al.  On Subtyping and Matching , 1995, ECOOP.

[19]  Andrew P. Black,et al.  Typechecking Polymorphism in Emerald , 1996 .

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

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

[22]  Simon L. Peyton Jones,et al.  Report on the programming language Haskell: a non-strict, purely functional language version 1.2 , 1992, SIGP.

[23]  John C. Mitchell,et al.  Theoretical aspects of object-oriented programming: types, semantics, and language design , 1994, Choice Reviews Online.

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

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

[26]  Jens Palsberg,et al.  A Denotational Semantics of Inheritance and Its Correctness , 1994, Inf. Comput..