Two Semantic Models of Object-Oriented Languages * Samuel N. Kamin Uday S. Reddy University of Illinois at Urbana-Champaign October 4, 1993 Abstract We present and compare two models of object-oriented languages. The first we call the closure model because it uses closures to encapsulate side effects on objects, and accordingly makes the operations on an object a part of that object. It is shown that this denotational framework is adequate to explain classes, instantiation, and inheritance in the style of Simula as well as Smalltalk–80. The second we call the data structure model because it mimics the implementations of data structure languages like CLU in representing objects by records of instance variables, while keeping the operations on objects separate from the objects themselves. This yields a model which is very simple, at least superficially. Both the models are presented by way of a sequence of languages, culminating in a language with Smalltalk–80-style inheritance. The mathematical relationship between them is then discussed and it is shown that the models give equivalent results. It will emerge from this discussion that more appropriate names for the two models might be the fixed-point model and the self-application model. 1 Introduction Object-oriented languages, such as Smalltalk–80 1 [GR83], have recently received a lot of attention. However, the term “object-oriented” does not seem to have a commonly accepted meaning. It is sometimes used to refer to the presence of data objects with local state, sometimes to the coupling of data with operations, sometimes to record subtyping, sometimes to the notion of class inheritance, and sometimes to the specific notion of inheritance in Smalltalk which involves a kind of “dynamic binding”. The first of these notions, viz., objects with local state, has long been used in the functional programming community to encapsulate “side effects” whenever they were necessary [ASS85, KL85]. These are sometimes loosely referred to as closures. A closure is essentially a function or a data structure containing functions with some local bindings to values or storage locations. In describing the semantics of object oriented languages, it seems natural that such a notion of closure should play a role. The second notion, * To appear in Gunter, C. and Mitchell, J. C. (eds) Theoretical aspects of Object-Oriented Programming, MIT Press, 1993. 1 Smalltalk–80” is a trademark of ParcPlace Systems. We use here a language called “SmallTalk” (with different capitalization) as an abstraction of Smalltalk–80. 1