[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Danny Bobrow <Bobrow.pa@Xerox.COM>
- Subject: Re: Reinitialization
- From: Gregor.pa@Xerox.COM
- Date: Thu, 7 Apr 88 10:34 PDT
- Cc: RPG@SAIL.STANFORD.EDU, common-lisp-object-system@SAIL.STANFORD.EDU
- Fcc: BD:>Gregor>mail>outgoing-mail-2.text
- In-reply-to: <880407-100805-6877@Xerox>
- Line-fold: no
Date: 7 Apr 88 10:07 PDT
From: Danny Bobrow <Bobrow.pa>
I liked Dick's variation on our proposal; that is, I like using a function
rather than a flag for variation. I also support his proposed addition to
with-added-methods of an option to specify the generic function.
However, there is a bug in the proposal. Since users never call class-changed
or update-instance-structure (only the system does), there is no way to change
the call, and shared-initialize will always be used (so why have an argument).
Here are two proposals to fix the bug, neither of which I like a lot, though I
prefer the first.
Unfortunately, I don't think either of these can work. The first
reduces directly to a stripped down version of the original proposal,
the second doesn't work for other reasons.
1) Have a generic function compute-initialization-function which returns
a function to use:
(defmethod compute-initialization-function ((instance standard-object))
(defmethod initialize-instance ((instance standard-object)
(apply (compute-initialization-function instance) instance initargs))
The problem here is that because compute-intialization-function doesn't
accept an argument saying who the caller is, it will return the same
value when called by initialize-instance, update-instance-structure etc.
This in effect reduces this to the original proposal where
initialize-instance, class-changed etc. all call the same generic
function. The only difference is that the function isn't called with an
argument that says who its caller is.
2) Have a special variable *initializer* with the a default value
#'shared-initialize, and use that. For some additonal flexibility, one could
allow initialize-instance and reinitialize-instance to have keyword argument
:initializer whose default value is *initializer*.
The problem with this is that the user can never know when
update-instance-structure is going to be called. This means it is
impossible to control the binding of *intializer* around calls to
Given this I see two alternatives:
Modify proposal 1 above so that there are three generic functions,
and class-changed-intiailizer. The standard method on each of these
would return #'shared-initialize. Users could define their own methods
on these generic function to control what shared initializer got used.
This is essentially Dick's proposal debugged.
Go back to the proposal Danny and I had originally.