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

Journal of Functional Programming - Tập 4 Số 2 - Trang 127-206 - 1994
Kim B. Bruce1
1Williams College, Williamstown, MA 0126, USA (Email: [email protected]

Tóm tắt

AbstractTo 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.

Từ khóa


Tài liệu tham khảo

Pierce, 1992, Proc. 19th ACM Symp. Principles of Program. Lang., 305

10.1016/0890-5401(90)90044-I

Meyer, 1992, Eiffel: The language

Bruce K.B. and van Gent R. (1993) TOIL: A new type-safe object-oriented imperative language. To appear.

10.1145/155183.155231

Mitchell, 1990, Handbook of Theoretical Computer Science, Volume B, 365

10.1145/6041.6042

Reddy, 1988, Proc. ACM Symp. Lisp and Functional Program. Lang., 289

10.1016/0890-5401(90)90062-M

Snyder, 1986, Proc. 1st ACM Symp. on Object-Oriented Program. Syst., Lang, and Applic., 38

America, 1986, Proc. 13th ACM Symp. on Principles of Program. Lang., 194

Liskov, 1988, OOPSLA Addendum to Proc., 17

Canning, 1989, Proc. ACM Conf. on Object-Oriented Program.: Syst., Lang. and Applic, 457

Tesler L. (1985) Object Pascal report. Technical Report 1, Apple Computer.

10.1145/62058.62060

America, 1987, Proc. ECOOP '87 – Lecture Notes in Computer Science 276, 234

Hense A.V. (1990) Denotational semantics of an object oriented programming language with explicit wrappers. Technical Report A 11/90, Universitat des Saarlandes.

Cook, 1989, Euro. Conf. on Object-Oriented Program., 57

10.1016/0890-5401(89)90057-6

Meyer, 1988, Object-Oriented Software Construction

10.1007/3-540-55511-0_5

10.1017/S0960129500001134

Castagna G. , Ghelli G. and Longo G. (1991) A calculus for overloaded functions with subtyping. Technical report, Ecole Normale Superieure.

Birtwistle, 1973, SIMULA Begin

Goldberg, 1983, Smalltalk–80: The language and its implementation

Cardelli, 1990, Math. Foundations of Prog. Lang. Semantics – Lecture Notes in Computer Science 442, 22

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.

10.1016/0890-5401(88)90007-7

Bruce, 1992, Proc. ACM Symp. on Principles of Program. Lang., 316

Kozen, 1993, 20th ACM Symp. Principles of Program. Lang.

Bruce, 1988, Proc. 3rd IEEE Symp. Logic in Comput. Sci., 38

Mitchell, 1984, Proc. Int. Symp. on Semantics of Data Types – Lecture Notes in Computer Science 173, 257

10.1017/S0956796800000198

Bruce, 1993, Proc. ACM Symp. on Object-Oriented Program.: Syst., Lang. and Applic., 29

Kamin, 1988, ACM Symp. Principles of Program. Lang., 80

Abadi M. (1992) Doing without F-bounded quantification. Message to Types electronic mail list, February.

10.1145/382192.383004

10.1016/0890-5401(91)90055-7

10.1016/0890-5401(88)90009-0

10.1145/97945.97964

Black A. (1992) Private communication.

Moon, 1986, Proc. ACM Conf. on Object-Oriented Program.: Syst., Lang. and Applic., 1

Cox, 1986, Object-Oriented Programming; An evolutionary appoach

Hense, 1991, TACS Proc., 548

Canning, 1989, Functional Prog. and Computer Architecture, 273

Breazu-Tannen, 1989, Proc. 4th IEEE Symp. Logic in Comput. Sci., 112

Black A. and Hutchinson N. (1991) Typechecking polymorphism in Emerald. Technical Report CRL 91/1 (Revised), DEC Cambridge Research Lab.

Schaffert, 1986, OOPSLA Proc., 21, 9

Cook, 1990, Proc. 17th ACM Symp. on Principles of Program. Lang., 125

Abadi, 1990, Proc. Symp. on Logic in Comput. Sci., 355

Cardelli L. (1992b) Typed foundations of object-oriented programming, 1992. Tutorial given at POPL '92.

10.1016/0890-5401(91)90074-C

Black, 1986, Proc. ACM Symp. on Object-Oriented Program.: Syst., Lang. and Applic., 78

Cardelli, 1988, Proc. 15th ACM Symp. Principles of Program. Lang., 70

Cardelli L. (1992a) Extensible records in a pure calculus of subtyping. Technical Report 81, DEC Systems Research Center.

Cardone, 1989, ICALP – Lecture Notes in Computer Science 372, 164

Cook, 1989, Proc. ACM Conf. on Object-Oriented Program.: Syst., Lang. and Applic., 433

Castagna, 1994, Proc. ACM Symp. on Principles of Program. Lang.

Cook W.R. (1989a) A Denotational Semantics of Inheritance. PhD thesis, Brown University.

Bruce, 1993, Proc. MFPS IX

van Gent R. (1993) TOIL: An imperative type-safe object-oriented language. Williams College Senior Honors Thesis.

Palsberg J. and Schwartzback M. (1991) Static typing for object-oriented programming. Technical report, Aarhus University Computer Science Department.

Gunter, 1992, Semantics of Programming Languages: Structures and Techniques

10.1002/spe.4380180707

Omohundro S.M. (1991) The Sather language. Technical report, International Computer Science Institute.

Pierce B.C. and Turner D.N. (1992a) Simple type-theoretic foundations for object-oriented programming. Technical report, University of Edinburgh.

Dimock A. and Muller R. (1992) Private communication.

10.1145/97945.97966

Mitchell, 1990, Proc. 17th ACM Symp. on Principles of Progra. Lang., 109

10.1145/97945.97965

10.1017/S0956796800001052

Pierce B.C. and Turner D.N. (1992b) Statically typed multi-methods via partially abstract types. Technical Report, University of Edinburgh.

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.

Pierce, 1993, Proc 20th ACM Symp. Principles of Program. Lang., 299

10.1145/44501.45065

10.1007/3-540-10250-7_24

Stroustrop, 1986, The C++ Programming Language

Ghelli, 1991, OOPSLA Proc., 129