Mixins

supplies a mixin module5 to allow the use mixin classes à la flavors. A mixin class is a class that can be used in a multiple inheritance network, but has certain restrictions to enable the creation of more efficient accessors—multiple inheritance is restricted to non-instantiable classes and these classes, mixins are then used for specialisation of instantiable objects, base-objects. Mixins tend to be used to describe attributes of objects, and then these are ``mixed in'' with base classes to create specialized classes. The mixin implementation has two metaclasses

Instances of <mixin-class> are not instantiable, but allow full MI. Only instances of <mixin-base-class> may inherit from mixin-classes, and the list of direct superclasses of a <mixin-base-class> must have all mixin-classes before a single non-mixin class (In , it may inherit from any other class in the system, including <class>).

Figure: Usage of mixin inhertance
\begin{figure}\beginlisp
(defclass <point> ()
((x initform 0 accessor point-x i...
...ake <colored-point> 'x 1 'y 1 'color 'red))
(color-of p2)
\endlisp\end{figure}
Note on the implementation: <mixin-class> has a different default slot type, <mixin-slot-description>. When this slot is inherited directly by a <mixin-base-class> its the accessor is computed. If the slot is not newly created, however, no new access method is computed, therefore reducing the number of such methods for a given accessor.