[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CLASS-CHANGED and UPDATE-OBSOLETE-INSTANCE
- To: Danny Bobrow <Bobrow.pa@Xerox.COM>
- Subject: Re: CLASS-CHANGED and UPDATE-OBSOLETE-INSTANCE
- From: kempf%hplabsz@hplabs.HP.COM
- Date: Thu, 01 Oct 87 11:16:44 MDT
- Cc: kempf%hplabsz@hplabs.HP.COM, common-lisp-object-system@sail.stanford.edu
- In-reply-to: Your message of 01 Oct 87 09:48:00 -0700. <871001-094833-3815@Xerox>
> 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))
> ...)
One could do the same thing as:
(defmethod change-class
((p1 x-y-point) (class (eql (class-named 'rho-theta-point))))
(let
( (p2 (call-next-method)) )
(with-slots (p2 rho theta)
(setf rho (rho p1))
(setf theta (theta p1)))))
(defmethod class-changed
((v1 directed-vector) (class (eql (class-named 'rho-theta-point))))
...
)