[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reinitialization
This issue has not been addressed yet, I think.
Date: Wed, 20 Apr 88 23:51 EDT
From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
check-initargs has to be called from four different places now,
as there are four updating functions that have initargs arguments.
I think the best way is to give check-initargs another argument,
which is a list of generic functions. An initarg is acceptable if
it's a slot-filling initarg or if any of the generic functions in
the list accepts it. make-instance would pass
(list #'allocate-instance #'initialize-instance #'initialize-new-instance).
reinitialize-instance would pass
(list #'reinitialize-instance #'initialize-new-instance).
The only problem with this is that each of these takes idiosyncratic
arguments, which check-initargs has to take into account when computing
the applicable methods. Is there a better idea?
The basic goal is that for each of the seven functions that take initargs
as arguments (make-instance, allocate-instance, initialize-new-instance,
reinitialize-instance, update-instance-for-redefined-class,
update-instance-for-different-class, and initialize-instance), the
keyword arguments accepted without error are the initargs for slot filling
and the initargs accepted by applicable methods for any generic function
that is going to see these initargs, and only those. I hope you can
understand that run-on sentence. Thus for example I can define
(defmethod initialize-instance :after ((i my-class) ignore &key moo) ...)
and now reinitialize-instance of my-class accepts :moo without my having
to say anything else.
The above idea for changing check-initargs isn't such a great one.
Other ideas: split check-initargs into seven functions for the seven
cases. Make allocate-instance, initialize-new-instance, and initialize-instance
never check their arguments, since they're only "supposed to be" called
from other functions that already checked the arguments, thus needing
only four versions of check-initargs (I don't like this idea). Give
check-initargs a flag argument which is the name of the function on
whose behalf it has been called. Invent some new way for generic functions
to communicate with each other and negotiate for who handles each initarg.
Any bright ideas?