Usually an inherited class is of the same metaclass as the parent class.
For other kinds of inheritance, you need to define a method on validate-superclass
which returns true when called with the respective metaclasses. For example:
(defclass mclass-1 (standard-class)
())
(defclass mclass-2 (standard-class)
())
(defclass a ()
()
(:metaclass mclass-1))
(defmethod validate-superclass
((class mclass-2)
(superclass mclass-1))
t)
(defclass b (a)
()
(:metaclass mclass-2))
Without the validate-superclass
method, the last form signals an error because mclass-1
is an invalid superclass of mclass-2
.
By default, defclass creates optimized standard accessors which do not call slot-value-using-class.
This optimization is controlled by the defclass option :optimize-slot-access
, which defaults to t
.
There is an illustration of this effect of :optimize-slot-access
in the example below.
Issues with MOP code that occur only in delivered LispWorks images are documented in the section "Delivery and the MOP" in the LispWorks Delivery User Guide .
LispWorks User Guide and Reference Manual - 13 Feb 2015