[Openmcl-devel] Is this a bug?
Ron Garret
ron at awun.net
Sun Feb 10 12:15:44 PST 2008
On Feb 9, 2008, at 6:21 PM, Gary Byers wrote:
> The MOP says that DEFCLASS of an existing class uses
> REINITIALIZE-INSTANCE to change that class (in-place), with initargs
> derived from the defclass form.
That's right. But even the MOP leaves a little wiggle room about
whether an unspecified option in defclass necessarily leads to an
unspecified keyword argument in the subsequent call to reinitialize-
instance.
From the description of DEFCLASS:
"The default initargs class option, if it is present in the defclass
form, becomes the value of the :direct-default-initargs keyword
argument to ensure-class."
But it doesn't actually say what happens if :default-initargs is not
specified. There is room to interpret this as, "If default-initargs
is not specified, then ensure-class is called with :direct-default-
initargs specified as nil."
Also, if you really want to hew to an unspecified-in-defclass-means-
unspecified (and hence sticky) -in-reinitialize-instance
interpretation, then an unspecified metaclass would be sticky too, but
it isn't:
? (defclass foo (ns:ns-object) () (:metaclass ns:+ns-object))
#<OBJC:OBJC-CLASS FOO (#xAADB810)>
? (defclass foo (ns:ns-object) ())
> Error: Can't change metaclass of #<OBJC:OBJC-CLASS FOO (#xAADB810)>
to #<OBJC:OBJC-METACLASS +FOO (#xAADB840)>.
and I would hope that anyone arguing that it should be would feel just
a little queasy about it.
rg
More information about the Openmcl-devel
mailing list