Type Destructors

We study a variant of System F that integrates and generalizes several existing proposals for calculi with structural typing rules. To the usual type constructors (!, , All, Some, Rec) we add a number of type destructors, each internalizing a useful fact about the subtyping relation. For example, in F with products every closed subtype of a product S T must itself be a product S T with S<:S and T<:T. We internalise this observation by introducing type destructors .1 and .2 and postulating an equivalence T = T.1 T.2 whenever T <: U V (including, for example, when T is a variable). In other words, every subtype of a product type literally is a product type, modulo -conversion. Adding type destructors provides a clean solution to the problem of polymorphic update without introducing new term formers, new forms of polymorphism, or quanti cation over type operators. We illustrate this by giving elementary presentations of two well-known encodings of objects, one based on recursive record types and the other based on existential packages. The formulation of type destructors poses some tricky meta-theoretic problems. We discuss two di erent variants: an \ideal" system where both constructors and destructors appear in general forms, and a more modest system, F , which imposes some restrictions in order to achieve a tractable metatheory. The properties of the latter system are developed in detail.

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

[2]  Martin Steffen,et al.  Polarized higher-order subtyping , 1998 .

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

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

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

[6]  Adriana B. Compagnoni,et al.  Decidability of Higher-Order Subtyping with Intersection Types , 1994, CSL.

[7]  Martín Abadi,et al.  An interpretation of objects and object types , 1996, POPL '96.

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

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

[10]  Martín Abadi,et al.  On subtyping and matching , 1995, TOPL.

[11]  J. Girard,et al.  Proofs and types , 1989 .

[12]  Luca Cardelli,et al.  A semantic basis for quest , 1990, Journal of Functional Programming.

[13]  Kim B. Bruce,et al.  Subtyping Is Not a Good "Match" for Object-Oriented Languages , 1997, ECOOP.

[14]  Benjamin C. Pierce,et al.  Higher-Order Subtyping , 1994, Theor. Comput. Sci..

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

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

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

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

[19]  Luca Cardelli,et al.  An Extension of System F with Subtyping , 1991, TACS.

[20]  Luca Cardelli,et al.  Comparing Object Encodings , 1997, Inf. Comput..

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

[22]  Martin Hofmann,et al.  A unifying type-theoretic framework for objects , 1994, Journal of Functional Programming.

[23]  Roberto M. Amadio,et al.  Recursion over Realizability Structures , 1991, Inf. Comput..