Changes between Initial Version and Version 1 of Ticket #877


Ignore:
Timestamp:
08/12/11 11:48:05 (3 years ago)
Author:
gb
Comment:

Note that

? (defclass foo () ((x :accessor x :initarg :x)) (:default-initargs :x 2))
#<STANDARD-CLASS FOO>
? (class-direct-default-initargs (find-class 'foo))
((:X 2 #<Anonymous Function #x3020006148DF>))
? (defclass foo () ((x :accessor x :initarg :x)) (:default-initargs))
#<STANDARD-CLASS FOO>
? (class-direct-default-initargs (find-class 'foo))
NIL

e.g., specifying the :DEFAULT-INITARGS option to DEFCLASS (with a null list of default initargs in this case) changes the class's direct default initargs, not specifying it has no effect when the class object is reinitialized. This is consistent with the MOP's model of class redefinition (where it ultimately involves REINITIALIZE-INSTANCE on the class object using a well-defined set of initargs derived from the expansion of DEFCLASS.

Implementations do differ in their treatment of your example: the versions of LispWorks? and CLISP that I have access to behave as you expect and the versions of SBCL, Allegro, and CCL behave the way that I think is correct. I don't think that CLHS says anything about what happens in this case, but (as I said) I think that what the MOP says is quite clear.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #877

    • Property Status changed from new to closed
    • Property Resolution changed from to invalid
  • Ticket #877 – Description

    initial v1  
    33 
    44__________ 
    5  
     5{{{ 
    66? (defclass foo () ((x :accessor x :initarg :x)) (:default-initargs :x 2)) 
    77 
     
    2323Instance slots 
    2424X: 2 
     25}}} 
     26