next up previous
Next: Generic Functions in Up: Programming Language Support Previous: Messages in Smalltalk

Messages and Active Values in Loops

  Loops [5] is a multi-paradigm language on top of Interlisp. One of the supported paradigms is object-oriented programming in the style of Smalltalk. Loops supports a message passing technique which is similar to message passing in Smalltalk. Consequently, the openness of Smalltalk achieved through dynamic method lookup is also present in Loops.

One of the other paradigms supported by Loops is called access-oriented programming [22] (also known as data-oriented programming [5]). The idea of access-oriented programming is to activate one or more methods upon access of particular data objects. Objects, which in this manner trigger methods, are called active values. Active values are typically (but not necessarily) bound to instance variables of classes. The application of active values is dual to programming in the object-oriented paradigm, in which it is the methods that access variables.

Reading an active value causes a get-message to be sent to the underlying object. Similarly, writing into an active value triggers a put-message. The objects that receive these messages must be instances of a class called ActiveValue, or instances of a subclass of ActiveValue.

In Loops applications, active values are typically used to obtain a modular design between two or more parts of an application. Separation of the simulation model from the monitoring aspects in a simulation program is a prototypical example of the use of active values. To achieve this separation, the objects in the simulation contain active values, which trigger the executions of operations in the monitoring part of the program.

Access of an active value may be regarded as an open point, which is closely associated with a particular mechanism in the language, namely variable access. The open point is bound by specializing an access method in a subclass of ActiveValue. Thus the binding mechanism is the same as that used for message passing as open points. (In the version of Loops described in [5] an open point is bound by specifying the name of the get-function and the put-function directly in the active value). Default binding of the open point is accounted for, because there already exist a default get-method and put-method in the class ActiveValue. Similarly, execution time binding of open points is achieved because of the properties of Loops' host environment, which is Interlisp. There is no provision for any particular documentation of active values in Loops.



next up previous
Next: Generic Functions in Up: Programming Language Support Previous: Messages in Smalltalk



Kurt Noermark
Wed Mar 6 09:44:24 MET 1996