...Scheme.
All the Scheme programs in this report are intended to conform with the Scheme Report [9]. Concretely, the practical programming has been done in MacScheme (version 2.0).

...methods.
The mapping of selectors to methods represents a level of indirection in the process of locating a method. It makes it also possible to have internal methods, simply by not including the methods in the mapping. Finally, the name of the selector, via which the method is known from the outside, is independent of the name of the method. Actually, the method may very well be a lambda expression placed directly in the conditional expression of self . If all methods are to be accessible via selectors identical to the method names, the mapping is a one-to-one mapping, and therefore trivial. In this case it would be much more flexible to be able to calculate the method given its selector. In Scheme, this is not possible. What is missing is the possibility to evaluate a symbol in the environment of self . The traditional eval primitive of Lisp is not part of Scheme, although most Scheme environments support it anyway. Furthermore, in order to use eval , it must be possible to capture the environment of self , and to pass this environment to eval .

...variable.
One can attempt to come up with alternative solutions to the ``instance variable access problem''. The procedure self can be extended such that reading and mutation is supported side by side with method lookup. However, this requires an entry in self for each such transaction, and it is hardly attractive explicitly to deal with such a wealth of details. If self is generated by the programming environment, this solution might become attractive.

....
Notice that if the method selectors in the class are symbols, the message should also be a symbol. In other words, message will be of the form 'message .

...length.
The use of append

and list could have been omitted, if the Scheme dialect in question supports the non-essential variation of apply , which takes a procedure and a number of arguments as parameters, the last of which is a list. MacScheme does not support this variant of apply .

...parts.
Actually it would be even closer to reality to describe an object as consisting of nested object parts.

...way:
The definition of object may be even simpler if dispatch is defined ``inline'' in the let construct at the place of nil . However, I believe that it is easiest to understand the classes and class patterns, if a standard ``style'' is being used.

...procedure:
It is, of course, also possible to have two variations of new-instance ; one which results in objects as those in figure gif(a), and one which results in objects as those in figure gif(b). It is also easy to make the decision a parameter of new-instance .

...class-id
For improved readability, class-id is a variable, which is bound to a ``gensymed symbol''. The same is true for the variable super-classes .

...).
For people who are familiar with the details of the definition of class precedence lists in CLOS [3], it may be interesting to compare the ``merge technique'', as described here, with the topological sorting procedure used in [3]. First it can be noticed that the ``merge procedure'' does not discover inconsistencies in the partial orderings generated by the class definitions. If, however, there are no inconsistencies, the ``merge procedure'' seems to give the same class precedence list as the deterministic topological sorting procedure.

...caching.
In the measurement, all methods were empty. In that way only the method lookups affect the timing.

...pattern:
I want to acknowledge Ole Lehrmann Madsen for giving me the concept of this simulation of metaclasses.

Kurt Noermark
Wed Mar 6 10:30:05 MET 1996