[armedbear-ticket] [armedbear] #119: Unexpected CLOS shared slot initialization order

armedbear armedbear-devel at common-lisp.net
Wed Jan 26 08:35:55 UTC 2011


#119: Unexpected CLOS shared slot initialization order
-----------------------+----------------------------------------------------
  Reporter:  mevenson  |       Owner:  analysis                
      Type:  defect    |      Status:  new                     
  Priority:  major     |   Milestone:  unscheduled             
 Component:  CLOS      |     Version:  1.0                     
Resolution:            |    Keywords:  clos unexpected-behavior
-----------------------+----------------------------------------------------

Comment(by ehuelsmann):

 Didier Verna follows up with:


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

-- 
Ticket URL: <http://trac.common-lisp.net/armedbear/ticket/119#comment:2>
armedbear <http://common-lisp.net/project/armedbear>
armedbear


More information about the armedbear-ticket mailing list