Next: inline
Declaration, Up: Slot Access Optimization [Contents][Index]
slot-boundp
DeclarationExample:
(defclass foo () (a b)) (defmethod bar ((x foo)) (declare (ext:slots (slot-boundp foo))) (list (slot-value x 'a) (slot-value x 'b)))
The slot-boundp
declaration in method bar
specifies that
the slots a
and b
accessed through parameter x
in
the scope of the declaration are always bound, because parameter
x
is specialized on class foo
to which the
slot-boundp
declaration applies. The PCL-generated code for
the slot-value
forms will thus not contain tests for the slots
being bound or not. The consequences are undefined should one of the
accessed slots not be bound.