Static type inference for parametric classes

Central features of object-oriented programming are method inheritance and data abstraction attained through hierarchical organization of classes. Recent studies show that method inheritance can be nicely supported by ML style type inference when extended to labeled records. This is based on the fact that a function that selects a field ƒ of a record can be given a polymorphic type that enables it to be applied to any record which contains a field ƒ. Several type systems also provide data abstraction through abstract type declarations. However, these two features have not yet been properly integrated in a statically checked polymorphic type system. This paper proposes a static type system that achieves this integration in an ML-like polymorphic language by adding a class construct that allows the programmer to build a hierarchy of classes connected by multiple inheritance declarations. Moreover, classes can be parameterized by types allowing “generic” definitions. The type correctness of class declarations is statically checked by the type system. The type system also infers a principal scheme for any type correct program containing methods and objects defined in classes.

[1]  Brian A. Wichmann,et al.  Rationale for the design of the Ada programming language , 1979, SIGP.

[2]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[3]  Atsushi Ohori,et al.  A simple semantics for ML polymorphism , 1989, FPCA.

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

[5]  David B. MacQueen Using dependent types to express modular structure , 1986, POPL '86.

[6]  Robin Milner,et al.  Definition of standard ML , 1990 .

[7]  Didier Rémy,et al.  Type checking records and variants in a natural extension of ML , 1989, POPL '89.

[8]  Gordon D. Plotkin,et al.  Call-by-Name, Call-by-Value and the lambda-Calculus , 1975, Theor. Comput. Sci..

[9]  Prateek Mishra,et al.  Type Inference with Subtypes , 1990, Theor. Comput. Sci..

[10]  Atsushi Ohori,et al.  Semantics of Types for Database Objects , 1988, Theor. Comput. Sci..

[11]  Renzo Orsini,et al.  GALILEO: a strongly-typed, interactive conceptual language , 1985, TODS.

[12]  B. Courcelle Fundamental properties of infinite trees , 1983 .

[13]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

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

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

[16]  Peter Buneman,et al.  A study of semantics, types and languages for databases and object-oriented programming , 1989 .

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

[18]  Mitchell Wand,et al.  Complete Type Inference for Simple Objects , 1987, LICS.

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

[20]  M. Wand,et al.  Corrigendum: complete type interference for simple objects , 1988, [1988] Proceedings. Third Annual Information Symposium on Logic in Computer Science.

[21]  Peter Buneman,et al.  Database programming in Machiavelli—a polymorphic language with static type inference , 1989, SIGMOD '89.

[22]  Butler W. Lampson,et al.  A Kernel Language for Abstract Data Types and Modules , 1984, Semantics of Data Types.

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

[24]  Ryan Stansifer,et al.  Type inference with subtypes , 1988, POPL '88.

[25]  Peter Buneman,et al.  Type inference in a database programming language , 1988, LISP and Functional Programming.

[26]  Peter Buneman,et al.  Can Object-Oriented Databases be Statically Typed? , 1989, DBPL.

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

[28]  Benjamin C. Pierce,et al.  A record calculus based on symmetric concatenation , 1991, POPL '91.

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

[30]  M. Tofte Operational Semantics and Polymorphic Type Inference , 1988 .

[31]  John C. Mitchell,et al.  ML with extended pattern matching and subtypes , 1988, LISP and Functional Programming.

[32]  D. A. Turner,et al.  Miranda: A Non-Strict Functional language with Polymorphic Types , 1985, FPCA.