Abstract
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 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 do 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 extensively stressed. We show that this calculus provides a foundation for typed object- oriented languages which solves some of the problems of the standard record-based approach.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
M Abadi L Cardelli P-L Curien Formal parametric polymorphismIn Dezani, Ronchi, and VenturinieditorsBöhm Festschr1993.
Roberto M. Amadio, Luca Cardelli. Subtyping recursive types. ACM Transactions on Programming Languages and Systems, 15(4):575–631, 1993. A preliminary version appeared in POPL’91 (pp. 104–118), and as DEC Systems Research Center Research Report number 62, August 1990.
H.P. Barendregt. The Lambda Calculus Its Syntax and Semantics. North-Holland, 1984. Revised edition.
Kim B. Bruce. The equivalence of two semantic definitions for inheritance in object- oriented languages. In Proceedings of Mathematical Foundations of Programming Semantics, Pittsburgh, PA, March 1991.
Peter Canning, William Cook, Walter Hill, Walter Olthoff, John Mitchell. F-bounded quantification for object-oriented programming. In Fourth International Conference on Functional Programming Languages and Computer Architecture, pages 273–280, September 1989.
L. Cardelli, J.C. Mitchell. Operations on records. Mathematical Structures in Computer Science, l(l):3–48, 1991.
L. Cardelli, P. Wegner. On understanding types, data abstraction, and polymorphism. Computing Surveys, 17(4):471–522, December 1985.
L Cardelli. A semantics of multiple inheritance. Information and Computation, 76:138–164, 1988. A previous version can be found in Semantics of Data Types, volume 173 of Lecture Notes in Computer Science, pages 51–67. Springer-Verlag, 1984.
G. Castagna. Strong typing in object-oriented paradigms. Technical Report 92–11, Lab- oratoire d’Informatique, Ecole Normale Supérieure — Paris, June 1992.
G. Castagna, G. Ghelli, G. Longo. A semantics for λ&-early: a calculus with overloading and early binding. In M. Bezen, J.F. Groote, editorsProc. of the International Conference on Typed Lambda Calculi and Applications (TLCA), Utrecht, The Netherlands, volume 664 of Lecture Notes in Computer Science, pages 107–123, Berlin, March 1993. Springer-Verlag.
G. Castagna, G. Longo. From inheritance to Quest’s type theory. In Ecole Jeunes Chercheurs du GRECO de Programmation, Sophia-Antipolis (Nice), April 1991. Talk given at the 5th Jumelage on Typed Lambda Calculus — Paris — January 1990.
W. R. Cook, W. L. Hill, P. S. Canning. Inheritance is not subtyping. 17th Ann. ACM Symp. on Principles of Programming Languages, January 1990.
M. Coppo, M. Denzani-Ciancaglini, B. Vernieri. Functional characters of solvable terms. Zeit. Math. Logik, 27:45–58, 1981.
P.-L. Curien, G. Ghelli. Coherence of subsumption, minimum typing and the type checking in F≤. Mathematical Structures in Computer Science, 2(1):55–91, 1992.
P.-L. Curien, G. Ghelli. Confluence and decidability of βηtop≤ reduction in F≤. Information and Computation, 109(1, 2):57–114, 1994.
L. G. DeMichiel, R. P. Gabriel. Common lisp object system overview. In Proc. of ECOOP’87 European Conference on Object Oriented Programming, 1987.
G. Ghelli. Proof Theoretic Studies about a Minimal Type System Integrating Inclusion and Parametric Polymorphism. PhD thesis, Dipartimento di Informatica, Università di Pisa, March 1990. Tech. Rep. TD–6/90.
G. Ghelli Modelling features of object-oriented languages in second order functional languages with subtypes. In J. W. de Bakker, W. P. de Roever, G. Rozenberg, editors, Foundations of Object-Oriented Languages, volume 489 of Lecture Notes in Computer Science, pages 311–340. Springer-Verlag, 1991.
G. Ghelli. A static type system for late binding overloading. In A. Paepcke, editor, Proc. of the Sixth Intl. ACM Conference on Object-Oriented Programming Systems Languages and Applications (OOPSLA), Phoenix, Arizona, number 26 (11) in ACM SIGPLAN Notices, pages 129–145, Reading, MA, 1991. Addison-Wesley.
Jean-Yves Girard, Yves Lafont, Paul Taylor. Proofs and Types, volume 7 of Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, Cambridge, 1989.
R. Hindley. The Church-Rosser property and a result of combinatory logic. Dissertation, 1964. University of Newcastle-upon-Tyne.
G. Longo. Parametric and type-dependent polymorphism. Fundamenta Informaticae, 1994. To appear.
G Longo, K. Milsted, S. Soloviev. The genericity theorem and parametricity in functional languages. In 8th Annual IEEE Symposium on Logic in Computer Science, Montreal, June 1993.
G. Longo, E. Moggi. Constructive natural deduction and its ω-set interpretation. Mathematical Structures in Computer Science, 1 (2):215–253, 1991.
QingMing Ma, John C. Reynolds. Types, abstraction, and parametric polymorphism, part 2. In Stephen Brookes, Michael Main, Austin Melton, Michael Mislove, David A. Schmidt, editors, Mathematical Foundations of Programming Semantics, volume 598 of Lecture Notes in Computer Science, pages 1–40. Springer-Verlag, 1992.
N. Martí-Oliet, J. Meseguer. Inclusions and subtypes. Technical report, SRI International, Computer Science Laboratory, December 1990.
J. C. Mitchell. Toward a typed foundation for method specialization and inheritance. Proc. of 17th Ann. ACM Symp. on Principles of Programming Languages, pages 109–124, January 1990.
John C. Mitchell. A type-inference approach to reduction properties and semantics of polymorphic expressions. In Gérard Huet, editor, Logical Foundations of Functional Programming, University of Texas at Austin Year of Programming Series, pages 195–212. Addison-Wesley, 1990.
B.C. Pierce. Intersection and union types. Technical report, Carnegie Mellon University.
BC Pierce DN. Turner. Simple type-theoretic foundations for object- oriented programming. Journal of Functional Programming, 4(2):207–247, April 1994. A preliminary version appeared in Principles of Programming Languages, 1993, and as University of Edinburgh technical report ECS–LFCS–92–225, under the title “Object-Oriented Programming Without Recursive Types”
J. C. Reynolds. Preliminary design of the programming language Forsythe. Technical Report CMU–CS–88–159, Carnegie Mellon University, June 1988.
J. C. Reynolds. The coherence of languages with intersection types. In T. Ito, A. R. Meyer, editors, Theoretical Aspects of Computer Software (Sendai, Japan), volume 526 of Lecture Notes in Computer Science, pages 675–700. Springer-Verlag, September.
B. K. Rosen. Tree manipulation systems and Church-Rosser theorems. Journal of the ACM, 20:160–187, 1973.
F. Rouaix. ALCOOL-90, Typage de la surcharge dans un langage fonctionnel. PhD thesis, Université PARIS VII, December 1990.
Philip Wadler, Stephen Blott. How to make “ad-hoc” polymorphism less “ad-hoc”. In 16th Ann. ACM Symp. on Principles of Programming Languages, pages 60–76, 1989.
M Wand Type inference for record concatenation and multiple inheritance. Information and Computation, 93(1): 1–15, 1991.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2000 Springer-Verlag Berlin Heidelberg
About this chapter
Cite this chapter
Castagna, G., Ghelli, G., Longo, G. (2000). A Calculus for Overloaded Functions with Subtyping. In: Atkinson, M.P., Welland, R. (eds) Fully Integrated Data Environments. Esprit Basic Research Series. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-59623-0_11
Download citation
DOI: https://doi.org/10.1007/978-3-642-59623-0_11
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-64055-1
Online ISBN: 978-3-642-59623-0
eBook Packages: Springer Book Archive