[armedbear-devel] initialization of shared slots

Didier Verna didier at lrde.epita.fr
Thu Jan 6 19:29:13 UTC 2011


Mark Evenson <evenson at panix.com> wrote:

> Filed as [ticket #119][1].
>
> The CLOS code is split between Java and Lisp, so we need to analyze 
> further: we'll keep you posted.
>
> Thanks for the report!
>
>
> [1]: http://trac.common-lisp.net/armedbear/ticket/119

  BTW, my name is Verna, not Verner :-)

So, after some discussion on cll and pro@, I have some precisions about
this. From what I understand of CLHS now, an implementation is not
required to initialize a shared slot at class creation time from the
initform (so far so good for ABCL).

However, the iniform of a shared slot must be evaluated in the dynamic
environment of the defclass call, even if it's not used to initialize
the slot right now (see the defclass page). The following test shows
that ABCL's behavior is currently incorrect in that regard:

(defclass fungy () 
  ((x :allocation :class 
      :initform (progn 
                  (format *debug-io* "~&x initform~%") 
                  6) 
      :initarg :x) 
   (y :initform (progn 
                  (format *debug-io* "~&y initform~%") 
                  7) 
      :initarg :y))) 

CL-USER(1): (defclass fungy () ...)
#<STANDARD-CLASS FUNGY {1AEE513}>

CL-USER(2): (make-instance 'fungy)
x initform                                <========= this is too late
y initform
#<FUNGY {18C2354}>

-- 
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