[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

default-initargs question



I noticed that the following simple defclass does not cause an error:

(defclass person () () (:default-initargs :x 5 :x 6))

Of course, if you attempt to do a make-instance on person you get an error:

 (make-instance 'person)
> Error: :X is an invalid initarg to INITIALIZE-INSTANCE for #<STANDARD-CLASS 
PERSON>.
>        Valid initargs: #().
> While executing: CCL::CHECK-INITARGS
> Type Command-. to abort.
See the Restarts. menu item for further choices.

Isn't this bug in the class person detectable at the time of the defclass, why 
isn't it found then?  Is CLOS defined to catch this type of error only at the 
make-instance but not at defclass?  It seem questionable to allow an invalid 
class to be created but perhaps that is the way CLOS is defined.

Also, according to Steel, p. 825, I interpret that the defclass should have 
caused an error because :x appears twice.  Is this a bug in MCL?