[closer-devel] Redefining classes

Michael Weber michaelw+closer at foldr.org
Thu Dec 1 10:22:09 UTC 2005


Hi,

this mailing list was the closest (hah!) I could find to a (still
active) MOP discussion list.  If my question is off-topic, I'd love
to hear where else to go.


I seem not to understand some aspects of class redefinition.  Suppose
the following situation:

(defclass foo ()
  (...)
  (:metaclass foo-metaclass))

(defclass foo-1 (foo)
  (...)
  (:metaclass foo-metaclass))

If I redefine FOO later on to add or remove slots, it gets
reinitialized, and I have

(defmethod shared-initialize :after ((class foo-metaclass) slot-names 
	                             &rest initargs 
                                     &key &allow-other-keys)
 ...)

which recalculates some slot-based information for FOO then.

However, FOO-1 is left unchanged, which surprised me a little.  I
would have expected that it gets reinitialized as well, thus giving
the above initializer a chance to recalculate information for FOO-1,
too.

I am using CLASS-SLOTS in the FOO-METACLASS specific initialization to
get to the slots of FOO-1, but that includes inherited slots from FOO
as well.  Clearly, after redefinition of FOO, that information might
be out of date for FOO-1.

Is there a way to invalidate and reinitialize all subclasses?  I would
assume that that's a common issue.

Or, if not, is there a (predefined) way to get only those effective
slots of a class which are not inherited?  I could use
CLASS-DIRECT-SLOTS, but that seems wrong, as I am supposed to work
with effective slots, no?


Cheers,
Michael



More information about the closer-devel mailing list