[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


    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))