[Openmcl-devel] :initarg caching

Gary Byers gb at clozure.com
Sun Jan 4 12:46:08 PST 2004

On Sun, 4 Jan 2004, Sven Van Caekenberghe wrote:

> I have encountered something odd in an image that I have currently open
> in emacs/slime:
> CL-USER> (defclass foo () ())
> CL-USER> (defclass foo () ((bar :accessor get-bar :initform 0 :initarg
> :bar :type symbol)))
> CL-USER> (make-instance 'foo :bar 'foo)
> :BAR is an invalid initarg to INITIALIZE-INSTANCE for #<STANDARD-CLASS
> FOO>.
> Valid initargs: #().
>     [Condition of type SIMPLE-ERROR]

> So no matter what I do, I can't redefine the class so that :bar is an
> :initarg for the bar slot.
> Sadly, I can't reproduce this behavior in a fresh image for a more
> useful bug report, although I tried.
> I'll try to keep the image open...

The code that tries to compute the set of valid initargs for a
"standard" initialization method (INITIALIZE-INSTANCE, REINITIALIZE-
INSTANCE, etc.) does so by looking to see if any possibly applicable
method function does &allow-other-keys (in which case all initargs are OK),
and collects the actual keywords accepted by the method functions into
a vector otherwise.

It apparently does this buggily and inconsistenly (hey, -this time- I
didn't write the code), but what it's trying to do isn't correct in
this case; the generic function #'INITIALIZE-INSTANCE should be defined
as if it said &ALLOW-OTHER-KEYS, and that should basically convince the
code trying to determine the valid initargs for the gf that there isn't
really a finite set of them ...

So, (a) it's wrong, and (b) apparently it's not deterministically
wrong (or it'd happen even more often.)

If you still have the session open, could you send me the output of

? (describe (find-class 'foo))

> Sven
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel

More information about the Openmcl-devel mailing list