Hostname: page-component-78c5997874-g7gxr Total loading time: 0 Render date: 2024-11-14T16:30:13.417Z Has data issue: false hasContentIssue false

A paradigmatic object-oriented programming language: Design, static typing and semantics

Published online by Cambridge University Press:  07 November 2008

Kim B. Bruce
Affiliation:
Williams College, Williamstown, MA 0126, USA (Email: kim@cs.williams.edu)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

To illuminate the fundamental concepts involved in object-oriented programming languages, we describe the design of TOOPL, a paradigmatic, statically-typed, functional, object-oriented programming language which supports classes, objects, methods, hidden instance variables, subtypes and inheritance.

It has proven to be quite difficult to design such a language which has a secure type system. A particular problem with statically type checking object-oriented languages is designing typechecking rules which ensure that methods provided in a superclass will continue to be type correct when inherited in a subclass. The type-checking rules for TOOPL have this feature, enabling library suppliers to provide only the interfaces of classes with actual executable code, while still allowing users to safely create subclasses. To achieve greater expressibility while retaining type-safety, we choose to separate the inheritance and subtyping hierarchy in the language.

The design of TOOPL has been guided by an analysis of the semantics of the language, which is given in terms of a model of the F-bounded second-order lambda calculus with fixed points at both the element and type level. This semantics supports the language design by providing a means to prove that the type-checking rules are sound, thus guaranteeing that the language is type-safe.

While the semantics of our language is rather complex, involving fixed points at both the element and type level, we believe that this reflects the inherent complexity of the basic features of object-oriented programming languages. Particularly complex features include the implicit recursion inherent in the use of the keyword, self, to refer to the current object, and its corresponding type, MyType. The notions of subclass and inheritance introduce the greatest semantic complexities, whereas the notion of subtype is more straightforward to deal with. Our semantic investigations lead us to recommend caution in the use of inheritance, since small changes to method definitions in subclasses can result in major changes to the meanings of the other methods of the class.

Type
Research Article
Copyright
Copyright © Cambridge University Press 1994

References

Abadi, M. (1992) Doing without F-bounded quantification. Message to Types electronic mail list, February.Google Scholar
Abadi, M. (1994) Baby modula-3 and a theory of objects. J. Functional Program. to appear.Google Scholar
Abadi, M. and Plotkin, G.D. (1990) A PER model of polymorphism and recursive types. In: Proc. Symp. on Logic in Comput. Sci., pp. 355365.Google Scholar
Amadio, R.M. (1991) Recursion over realizability structures. Infor. and Computation 91(1): 5586.CrossRefGoogle Scholar
Amadio, R. and Cardelli, L. (1993) Subtyping recursive types. ACM TOPLAS 15(4): 575631.CrossRefGoogle Scholar
America, P. (1987) Inheritance and subtyping in a parallel object-oriented language. In: Bezivin, J. et al. , Eds., Proc. ECOOP '87 – Lecture Notes in Computer Science 276, pp. 234242, Springer.Google Scholar
America, P., de Bakker, J., Kok, J. and Rutten, J. (1986) Operational semantics of a parallel object-oriented language. In: Proc. 13th ACM Symp. on Principles of Program. Lang., pp. 194208.Google Scholar
America, P., de Bakker, J., Kok, J. and Rutten, J. (1989) Denotational semantics of a parallel object-oriented language. Infor. and Computation 83(2): 152205.Google Scholar
America, P. and van der Linden, F. (1990) A parallel object-oriented language with inheritance and subtyping. In: OOPSLA-ECOOP '90 Proceedings, pp. 161168, October. (ACM SIGPLAN Not. 25(10).)CrossRefGoogle Scholar
Birtwistle, G.M., Dahl, O.-J., Myhrhaug, B. and Nygaard, K. (1973) SIMULA Begin. Aurbach.Google Scholar
Black, A. (1992) Private communication.Google Scholar
Black, A. and Hutchinson, N. (1991) Typechecking polymorphism in Emerald. Technical Report CRL 91/1 (Revised), DEC Cambridge Research Lab.Google Scholar
Black, A., Hutchinson, N., Jul, E. and Levy, H. (1986) Object structure in the Emerald system. In: Proc. ACM Symp. on Object-Oriented Program.: Syst., Lang. and Applic., pp. 7886, October.Google Scholar
Breazu-Tannen, U., Coquand, T., Gunter, C.A. and Scedrov, A. (1989) Inheritance and explicit coercion. In: Proc. 4th IEEE Symp. Logic in Comput. Sci., pp. 112129.Google Scholar
Breazu-Tannen, U., Coquand, T., Gunter, C.A. and Scedrov, A. (1991) Inheritance and implicit coercion. Infor. and Computation 93(1): 172221.CrossRefGoogle Scholar
Bruce, K. (1992) The equivalence of two semantic definitions of inheritance in object-oriented languages. In: Brookes, S.Main, M., Melton, A., Mislove, M. and Schmidt, D., Eds., Proc. 7th Int. Conf. on Mathematical Foundations of Program. Semantics – Lecture Notes in Computer Science 598, pp. 102124, Springer.Google Scholar
Bruce, K., Crabtree, J., Dimock, A., Muller, R., Murtagh, T. and van Gent, R. (1993) Safe and decidable type checking in an object-oriented language. In: Proc. ACM Symp. on Object-Oriented Program.: Syst., Lang. and Applic., pp. 2946.Google Scholar
Bruce, K., Crabtree, J. and Kanapathy, G. (1993) An operational semantics for TOOPLE: A statically-typed object-oriented programming language. In: Proc. MFPS IX, to appear.Google Scholar
Bruce, K. and Longo, G. (1988) A modest model of records, inheritance and bounded quantification. In: Proc. 3rd IEEE Symp. Logic in Comput. Sci., pp. 3851.Google Scholar
Bruce, K. and Longo, G. (1990) A modest model of records, inheritance and bounded quantification. Infor. and Computation 87(1/2): 196240.Google Scholar
Bruce, K.B., Meyer, A.R. and Mitchell, J.C. (1990) The semantics of second-order lambda calculus. Infor. and Computation 85(1): 76134. (Reprinted in G. Huet, Ed., Logical Foundations of Functional Programming, Addison-Wesley, Reading, MA, 1990, pp. 213–273.)CrossRefGoogle Scholar
Bruce, K.B. and Mitchell, J.M. (1992) PER models of subtyping, recursive types and higher-order polymorphism. In: Proc. ACM Symp. on Principles of Program. Lang., pp. 316327.Google Scholar
Bruce, K.B. and van Gent, R. (1993) TOIL: A new type-safe object-oriented imperative language. To appear.Google Scholar
Canning, P., Cook, W., Hill, W., Mitchell, J. and Olthoff, W. (1989) F-bounded quantification for object-oriented programming. In: Functional Prog. and Computer Architecture, pp. 273280.Google Scholar
Canning, P., Cook, W., Hill, W. and Olthoff, W. (1989) Interfaces for strongly-typed object-oriented programming. In: Proc. ACM Conf. on Object-Oriented Program.: Syst., Lang. and Applic, pp. 457467.Google Scholar
Cardelli, L. (1988a) A semantics of multiple inheritance. Infor. and Computation 76: 138164. (Special issue devoted to Symp. on Semantics of Data Types, Sophia-Antipolis (France), 1984.)Google Scholar
Cardelli, L. (1988b) Structural subtyping and the notion of powertype. In: Proc. 15th ACM Symp. Principles of Program. Lang., pp. 7079.Google Scholar
Cardelli, L. (1992a) Extensible records in a pure calculus of subtyping. Technical Report 81, DEC Systems Research Center.Google Scholar
Cardelli, L. (1992b) Typed foundations of object-oriented programming, 1992. Tutorial given at POPL '92.Google Scholar
Cardelli, L., Donahue, J., Galssman, L., Jordan, M., Kalsow, B. and Nelson, G. (1988) Modula-3 report. Technical Report SRC-31, DEC systems Research Center.Google Scholar
Cardelli, L. and Longo, G. (1991) A semantic basis for Quest. J. Functional Program. 1(4): 417458.CrossRefGoogle Scholar
Cardelli, L. and Mitchell, J. C. (1990) Operations on records. In: Math. Foundations of Prog. Lang. Semantics – Lecture Notes in Computer Science 442, pp. 2252. Springer.Google Scholar
Cardelli, L. and Wegner, P. (1985) On understanding types, data abstraction, and polymorphism. Comput. Surv. 17(4): 471522.Google Scholar
Cardone, F. (1989) Relational semantics for recursive types and bounded quantification. In: ICALP – Lecture Notes in Computer Science 372, pp. 164178, Springer.Google Scholar
Castagna, G., Ghelli, G. and Longo, G. (1991) A calculus for overloaded functions with subtyping. Technical report, Ecole Normale Superieure.Google Scholar
Castagna, G. and Pierce, B. (1994) Decidable bounded quantification. In: Proc. ACM Symp. on Principles of Program. Lang.Google Scholar
Cook, W.R. (1989a) A Denotational Semantics of Inheritance. PhD thesis, Brown University.Google Scholar
Cook, W.R. (1989b) A proposal for making Eiffel type-safe. In: Euro. Conf. on Object-Oriented Program., pp. 5772.Google Scholar
Cook, W.R., Hill, W.L. and Canning, P.S. (1990) Inheritance is not subtyping. In: Proc. 17th ACM Symp. on Principles of Program. Lang., pp. 125135, January.Google Scholar
Cook, W. and Palsberg, J. (1989) A denotational semantics of inheritance and its correctness. In: Proc. ACM Conf. on Object-Oriented Program.: Syst., Lang. and Applic., pp. 433444.Google Scholar
Cox, B. (1986) Object-Oriented Programming; An evolutionary appoach. Addison-Wesley, Reading, MA.Google Scholar
Curien, P.L. and Ghelli, G. (1992) Coherence of subsumption, minimum typing and type-checking in F . Mathematical Structures in Comput. Sci. 2: 5591.CrossRefGoogle Scholar
Danforth, S. and Tomlinson, C. (1988) Type theories and object-oriented programming. ACM Comput. Surv. 20(1): 2972.Google Scholar
Dimock, A. and Muller, R. (1992) Private communication.Google Scholar
Ghelli, G. (1991) A static type system for message passing. In: OOPSLA Proc., pp. 129145. (ACM SIGPLAN Not. 26(11), November.)Google Scholar
Goldberg, A. and Robson, D. (1983) Smalltalk–80: The language and its implementation. Addison Wesley, Reading, MA.Google Scholar
Gunter, C.A. (1992) Semantics of Programming Languages: Structures and Techniques. MIT Press, Cambridge, MA.Google Scholar
Hense, A.V. (1990) Denotational semantics of an object oriented programming language with explicit wrappers. Technical Report A 11/90, Universitat des Saarlandes.Google Scholar
Hense, A.V. (1991) Wrapper semantics of an object oriented programming language with state. In: TACS Proc., pp. 548568, Springer.Google Scholar
Kamin, S. (1988) Inheritance in Smalltalk-80: a denotational definition. In: ACM Symp. Principles of Program. Lang., pp. 8087.Google Scholar
Kozen, D., Palsberg, J. and Schwartzbach, M.I. (1993) Efficient recursive subtyping. In: 20th ACM Symp. Principles of Program. Lang.Google Scholar
Liskov, B. (1988) Data abstraction and hierarchy. In: OOPSLA Addendum to Proc., pp. 1734. (ACM SIGPLAN Not. 23(5), May.)Google Scholar
Madsen, O., Magnusson, B. and Moller-Pedersen, B. (1990) Strong typing of object-oriented languages revisited. In: OOPSLA-ECOOP Proc., pp. 140150. (ACM SIGPLAN Not. 25(10), October.Google Scholar
Meyer, B. (1988) Object-Oriented Software Construction. Prentice-Hall, Englewood Cliffs, NJ.Google Scholar
Meyer, B. (1992) Eiffel: The language. Prentice-Hall, Englewood Cliffs, NJ.Google Scholar
Mitchell, J.C. (1984) Type inference and type containment. In: Proc. Int. Symp. on Semantics of Data Types – Lecture Notes in Computer Science 173, Sophia-Antipolis, France, pp. 257278, June, Springer.Google Scholar
Mitchell, J.C. (1988) Polymorphic type inference and containment. Infor. and Computation 76(2/3): 211249. (Reprinted in G. Huet, Ed., Logical Foundations of Functional Programming, Addison-Wesley, Reading, MA, 1990, pp. 153–194.)Google Scholar
Mitchell, J.C. (1990a) Toward a typed foundation for method specialization and inheritance. In: Proc. 17th ACM Symp. on Principles of Progra. Lang., pp. 109124, January.Google Scholar
Mitchell, J.C. (1990b) Type systems for programming languages. In: van Leeuwen, J., Ed., Handbook of Theoretical Computer Science, Volume B, pp. 365458, North-Holland, Amsterdam.Google Scholar
Mitchell, J.C. and Plotkin, G.D. (1988) Abstract types have existential types. ACM Trans. Program. Lang. and Syst. 10(3): 470502. (Preliminary version appeared in Proc. 12th ACM Symp. on Principles of Program. Lang.)Google Scholar
Moon, D. (1986) Object-oriented programming with flavors. In: Proc. ACM Conf. on Object-Oriented Program.: Syst., Lang. and Applic., pp. 19.Google Scholar
Omohundro, S.M. (1991) The Sather language. Technical report, International Computer Science Institute.Google Scholar
Palsberg, J. and Schwartzback, M. (1990) Type substitution for object-oriented programming. In: OOPSLA-ECOOP Proc., pp. 151160. (ACM SIGPLAN Not. 25(10), October.)Google Scholar
Palsberg, J. and Schwartzback, M. (1991) Static typing for object-oriented programming. Technical report, Aarhus University Computer Science Department.CrossRefGoogle Scholar
Pierce, B.C. (1992) Bounded quantification is undecidable. In: Proc. 19th ACM Symp. Principles of Program. Lang., pp. 305315.Google Scholar
Pierce, B.C. and Hoffman, M. (1992) An abstract view of objects and subtyping (preliminary report). Technical Report ECS-LFCS-92-226, University of Edinburgh.Google Scholar
Pierce, B.C. and Turner, D.N. (1992a) Simple type-theoretic foundations for object-oriented programming. Technical report, University of Edinburgh.Google Scholar
Pierce, B.C. and Turner, D.N. (1992b) Statically typed multi-methods via partially abstract types. Technical Report, University of Edinburgh.Google Scholar
Pierce, B.C. and Turner, D.N. (1993) Object-oriented programming without recursive types. In: Proc 20th ACM Symp. Principles of Program. Lang., pp. 299312.Google Scholar
Reddy, U.S. (1988) Objects as closures: Abstract semantics of object-oriented languages. In: Proc. ACM Symp. Lisp and Functional Program. Lang., pp. 289297, July.Google Scholar
Reynolds, J.C. (1980) Using category theory to design implicit conversions and generic operators. In Jones, N.D., Ed., Semantics-Directed Compiler Generation – Lecture Notes in Computer Science 94, pp. 2112580, Springer.Google Scholar
Schaffert, C., Cooper, T., Bullis, B., Kilian, M. and Wilpolt, C. (1986) An introduction to Trellis/Owl. In: OOPSLA Proc., pp. 916. (ACM SIGPLAN Not. 21(11), November.)Google Scholar
Snyder, A. (1986) Encapsulation and inheritance in object-oriented programming languages. In: Proc. 1st ACM Symp. on Object-Oriented Program. Syst., Lang, and Applic., pp. 3846, October.Google Scholar
Stroustrop, B. (1986) The C++ Programming Language. Addison-Wesley, Reading, MA.Google Scholar
Tesler, L. (1985) Object Pascal report. Technical Report 1, Apple Computer.Google Scholar
van Gent, R. (1993) TOIL: An imperative type-safe object-oriented language. Williams College Senior Honors Thesis.Google Scholar
Wegner, P. (1990) Concepts and paradigms of object-oriented programming. OOPS Messenger 1(1): 787, August.Google Scholar
Wirth, N. (1988) The programming language Oberon. Software - Practice and Experience 18: 671690.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.