A Calculus for Overloaded Functions with Subtyping

We present a simple extension of typed ?-calculus where functions can be overloaded by putting different "branches of code" together. When the function is applied, the branch to execute is chosen according to a particular selection rule which depends on the type of the argument. The crucial feature of the present approach is that the branch selection depends on the "run-time type" of the argument, which may differ from its compile-time type, because of the existence of a subtyping relation among types. Hence overloading cannot be eliminated by a static analysis of code, but it is an essential feature to be dealt with during computation. We obtain in this way a type-dependent calculus, which differs from the various ?-calculi where types to not play any role during computation. We prove confluence and a generalized subject-reduction theorem for this calculus. We prove strong normalization for a "stratified" subcalculus. The definition of this calculus is guided by the understanding of object-oriented features and the connections between our calculus and object-orientedness are extensive stressed. We show that this calculus provides a foundation for types object-oriented languages which solves some of the problems of the standard record-based approach.

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

[2]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

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

[4]  Giuseppe Castagna,et al.  A Semantics for Lambda&-early: A Calculus with Overloading and Early Binding , 1993, TLCA.

[5]  John C. Reynolds,et al.  Preliminary design of the programming language Forsythe , 1988 .

[6]  Eugenio Moggi,et al.  Constructive Natural Deduction and its 'Omega-Set' Interpretation , 1991, Math. Struct. Comput. Sci..

[7]  Giorgio Ghelli,et al.  Decidability and Confluence of \beta\eta\hboxtop_\le Reduction in F_\le , 1994, Inf. Comput..

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

[9]  John C. Reynolds,et al.  The Coherence of Languages with Intersection Types , 1991, TACS.

[10]  Giorgio Ghelli A static type system for message passing , 1991, OOPSLA 1991.

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

[12]  Linda G. DeMichiel,et al.  The Common Lisp Object System: An Overview , 1987, ECOOP.

[13]  Mitchell Wand,et al.  Type inference for record concatenation and multiple inheritance , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[14]  John C. Reynolds,et al.  Types, Abstractions, and Parametric Polymorphism, Part 2 , 1991, MFPS.

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

[16]  Giuseppe Longo,et al.  Parametric and Type-Dependent Polymorphism , 1995, Fundam. Informaticae.

[17]  Denise A. Troll Library Information System II: Progress Report and Technical Plan. , 1990 .

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

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

[20]  John C. Mitchell A type-inference approach to reduction properties and semantics of polymorphic expressions (summary) , 1986, LFP '86.

[21]  Giorgio Ghelli,et al.  Modelling Features of Object-Oriented Languages in Second Order Functional Languages with Subtypes , 1990, REX Workshop.

[22]  Giuseppe Castagna A Meta-Language for Typed Object-Oriented Languages , 1995, Theor. Comput. Sci..

[23]  Philip Wadler,et al.  How to make ad-hoc polymorphism less ad hoc , 1989, POPL '89.

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

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

[26]  Francois M. Rouaix Alcool-90. Typage de la surcharge dans un langage fonctionnel , 1990 .

[27]  Mariangiola Dezani-Ciancaglini,et al.  Functional Characters of Solvable Terms , 1981, Math. Log. Q..

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

[29]  Martín Abadi,et al.  Formal parametric polymorphism , 1993, POPL '93.

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