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]  Bruno Courcelle,et al.  Fundamental Properties of Infinite Trees , 1983, Theor. Comput. Sci..

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

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

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

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

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

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

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

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

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

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

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

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

[14]  Peter Buneman,et al.  Using Powerdomains to Generalize Relational Databases , 1991, Theor. Comput. Sci..

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

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

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

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

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

[20]  C. Zheng,et al.  ; 0 ; , 1951 .

[21]  BunemanPeter,et al.  Database programming in Machiavellia polymorphic language with static type inference , 1989 .

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

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

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

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

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

[27]  Luca Cardelli,et al.  A Semantics of Multiple Inheritance , 1984, Inf. Comput..

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

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

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