[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CLASS-CHANGED and UPDATE-OBSOLETE-INSTANCE
- To: kempf%hplabsz@hplabs.HP.COM
- Subject: Re: CLASS-CHANGED and UPDATE-OBSOLETE-INSTANCE
- From: Danny Bobrow <Bobrow.pa@Xerox.COM>
- Date: 1 Oct 87 09:48 PDT
- Cc: common-lisp-object-system@sail.stanford.edu
- In-reply-to: kempf%hplabsz@hplabs.HP.COM's message of Thu, 01 Oct 87 10:02:35 MST
- Sender: Bobrow.pa@Xerox.COM
But the semantic delta here seems very minor, since, in both
cases, by the time the respective generic function gets the
instance, the structure has changed. The only difference is how the
information on the old instance is transferred to the generic
function. In the case of UPDATE-OBSOLETE-INSTANCE, it is through
lists of slots and their values, while through CLASS-CHANGED, it
seems to be through a copy of the old instance.
Why not simply replace CLASS-CHANGED? Am I missing something?
Yes. First, it is possible to specialize class-changed on the basis of
both classes, and secondly, one can use methods on the class of the
first (previous) object e.g.
(defmethod class-changed ((p1 x-y-point) (p2 rho-theta-point))
(with-slots (p2 rho theta)
(setf rho (rho p1)
theta (theta p1))))
(defclass class-changed ((v1 directed-vector) (p rho-theta-point))
...)