[armedbear-devel] initialization of shared slots

Didier Verna didier at lrde.epita.fr
Wed Jan 5 11:27:36 UTC 2011


it seems that until now, I've been relying on a non-standard behavior,
namely the fact that shared slots with an :initform are initialized
before the first actual class instance is created:

(defclass test () ((slot :allocation :class :initform t)))

(defmethod initialize-instance :before ((test test) &key)
   (format t "Slot boundp: ~A~%" (slot-boundp test 'slot)))

CL-USER> (make-instance 'test)
Slot boundp: NIL
#<TEST {C5D3B8}>
CL-USER> (make-instance 'test)
Slot boundp: T
#<TEST {14563D4}>

I just fell on this because every other Common Lisp implementation I've
tried gives T and T here. Is it due to the way CLOS is implemented in
ABCL, and is there a chance that this can be improved?


Resistance is futile. You will be jazzimilated.

Scientific site:   http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com

More information about the armedbear-devel mailing list