On Wed, Mar 10, 2010 at 2:12 PM, Alessio Stalla alessiostalla@gmail.com wrote:
On Wed, Mar 10, 2010 at 8:50 PM, Blake McBride blake@mcbride.name wrote:
(slot-value (make-instance 'class1) 'cv2)
creates an instance.
Sure, but (slot-value (mop::class-prototype (find-class 'class1)) 'cv2) does not and still fails with a slot-missing error, which was my point.
He wanted access to a true class variable,
no, he wanted to "access class-allocated slot values" in his own words. This, in the context of CL, can only mean slots with :allocation :class.
stored in the class (class1) that was accessible via a class reference. If that's what he wanted, that's exactly what my code does.
My example code does store cv? in class1, not the meta-class.
It's perfectly fine, but cv? are not class-allocated slots, at least not as the CL standard defines them.
Alessio
A class defines what (instance) variables are in instances of itself. A metaclass defines what (class) variables are defined in its instances (the class). Therefore, semantics aside, a metaclass defines what (class) variables are _stored_ in the class itself - not the meta class, and not instances of the class. My example does in fact store the class variables in the class and not in the metaclass since the metaclass defines what variables are in its instances - the class itself.
Blake McBride