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

Re: 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:
> 
> 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.

It is not an error because person could be intended to be an abstract mixin
class that gets combined with some other class which accepts :x as an initarg
name.

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

Yes.