Tim Bradshaw pointed out that my message was not very clear because the
test I gave does not demonstrate that an initform's result is used to
initialize the slot early, only at which time a slot is initialized.
This on the other hand gets closer to the point:
(defclass test ()
((slot :allocation :class :initform t :initarg :slot)))
(defmethod initialize-instance :before ((test test) &key)
(format t "Slot value: ~A~%" (slot-value test 'slot)))
Fresh SBCL:
CL-USER> (make-instance 'test)
Slot value: T
#<TEST {B8115E1}>
Fresh SBCL again:
CL-USER> (make-instance 'test :slot nil)
Slot value: T
#<TEST {B92AC89}>
So it appears that even when an initarg is provided, the slot is still
initialized to the iniform value prior to anything else.
--
Resistance is futile. You will be jazzimilated.
Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
_______________________________________________
pro mailing list
[email protected]
http://common-lisp.net/cgi-bin/mailman/listinfo/pro