Object Semantics

Presented: Viera K. Proulx
Transcribed: Therapon Skotiniotis

As Object-Oriented (OO) programming was gaining more and more attention, the first attempts were made to formulate the semantics of an OO Language (OOL). An introduction (summary) paper by Cardelli and Wagner served as a reference of what are the key mechanisms of an OOL. The paper covered mechanisms like, inheritance and the relationship that must hold between subtypes and supertypes, a notion of quantified types to express the types of functions (i.e. f:x -> x provides a generic function over all types) and existential quantification, to denote that a type exists that can satisfy the type relationship designated by a function (i.e. ∃ α: α x (α -> Int)). however, this paper does not provide a semantic account of these mechanisms

However, Kamin and Reddy independently developed denotational semantics for OOLs. Kamin's model is a data structure model along with functions on their domains with information being obtained from the environment. Kamin uses a function called Hierarchy to obtain from a ClassName a ClassDefinition. When a message (m) is sent to an object (o), the hierarchy of is queried to obtain the ClassDefinition. Given the definition the methods found in ClassDefinition are searched to find the one matching the signature of the message received m. If none is found then we continue to look up one level in the hierarchy (superclass). In order to "close the loop of searching in the hierarchy" a fixpoint is introduced over the whole function that searched for a a message on a ClassDefinition.

Reddy's model was based on closures and stores. He develops the system iteratively providing four languages each with different mechanism. From the simplest one where only objects are provided from the language (ObjectTalk), to one with only classes (ClassTalk), one with inheritance where classes are fixed in the environment at creation time have override (InheritTalk) and finally to one where you can have multiple dispatch (SmallTalk). Reddy provides a mechanism to allocate new objects in the store (σ) and update the environment (η) with a new binding to the object. The lookup mechanism again uses a fixpoint to closet the loop of searching for a method's definition. However the fixpoint is called (and used) differently than in the case of Kamin's model.

Kamin and Reddy have attempted in another paper to join their two models. The attempt to prove equivalence between their models was not successful. The main point of disagreement between them was the difference in their fixpoint operator's usage. The denotational approaches to explain OOL mechanisms did not reveal itself as fruitful as expected. The approach revealed lot of detail as a model without providing a clear understanding of the mechanisms behind OOL. Later work in the field of semantics of OOL (Cook and Palsberg being one of the first) attempt to provide OOL semantics using operational semantics instead.