From: Bruno H. <br...@cl...> - 2004-06-01 14:55:46
|
The MOP spec says about COMPUTE-SLOTS's primary methods: "This method can be overridden." But when trying to do this, to add a new local or shared slot, I get an error: (use-package "SB-PCL") (defclass b (a) ()) (defmethod compute-slots ((class (eql (find-class 'b)))) (append (call-next-method) (list (make-instance 'standard-effective-slot-definition :name 'y :allocation :instance)))) (defclass a () ((x :allocation :class))) ;; A should now have a shared slot, X, and a local slot, Y. (mapcar #'slot-definition-location (class-slots (find-class 'b))) => There is no applicable method for the generic function #<STANDARD-GENERIC-FUNCTION CLASS-SLOTS (3)> when called with arguments (NIL). (use-package "SB-PCL") (defclass b (a) ()) (defmethod compute-slots ((class (eql (find-class 'b)))) (append (call-next-method) (list (make-instance 'standard-effective-slot-definition :name 'y :allocation :class)))) (defclass a () ((x :allocation :class))) ;; A should now have two shared slots, X and Y. (mapcar #'slot-definition-location (class-slots (find-class 'b))) => There is no applicable method for the generic function #<STANDARD-GENERIC-FUNCTION SB-PCL::CLASS-SLOT-CELLS (1)> when called with arguments (NIL). Bruno |