|From: Raymond Toy <[EMAIL PROTECTED]> |Date: Thu, 04 Dec 2008 09:27:29 -0500 | |(defclass foo2 () | ((slot :type single-float :initform 1.2f0) | (slot2))) | |(defclass bar () | ((a :type fixnum :initform 0))) | |(defparameter *o* (make-instance 'foo2)) | |(defmethod setslot ((obj bar) val) | (setf (slot-value *o* 'slot) val) | (setf (slot-value obj 'a) val)) | | |Compile up the previous code. Then (setf (slot-value (make-instance |'foo2) 'slot) "string") signals an error. | |But (setslot (make-instance 'bar) 99) doesn't signal an error even |though we're assigning a fixnum to a slot of type single-float. |Hence, the change I made doesn't apply to slot-value in methods. (I |guess slot-value in methods takes a different path.)
Yes, actually I believe this was also the motivating reason for making this change in the first place: (see didier's original message) viz. that setf slot-value was not triggering an error while setslot was. , So it was clear there were two different code paths, and you added an explicit check-type to one of them. |I don't know PCL well enough to know exactly how methods get called or |which ones are run. -- Regards Madhu