Previous: Compiler Transformations, Up: Slot-Value
Even when nothing is known at compile-time about the call to
slot-value, it is possible to do marginally better than in
Example 7.2. Each effective slot definition
metaobject can cache its own effective method, and the discriminating
function for slot-value-using-class is set to simply call the
function in its slot definition argument.
(FIXME: I'm pretty sure this is a bad plan in general. Or rather, it's
probably a good plan, but the effective methods should probably be
computed lazily rather than eagerly. The default image has 8589
closures implementing this optimization: 3 (slot-value,
set-slot-value and slot-boundp) for each of 2863 effective
slots.)
(Also note that this optimization depends on not being able to
specialize the new-value argument to (setf
slot-value-using-class).)