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

Re: Class redefinition and class-changed.



     Date: 9 Jul 87 11:51 PDT
     From: Danny Bobrow <Bobrow.pa@xerox.com>
     Subject: Re: Class redefinition and class-changed.
     
         Goals:
     
          - There should be a way to define a method for class-changed
         on the obsolete class and the class.
     
          - This method needs to be defined before any the instances is
         changed, otherwise it wouldn't get invoked on all the instances of
         the class.
     
     Agreed.
     
     The necessary and sufficient condition for this is to be able to get
     hold of an obsolete version of a class.  

I don't agree.  We said in chapter 1 that the updating of the instances is done
at an implementation-dependent time.  It means that unless you prepare your
methods in advance (before the class is actually redefined) you are going to let
some instances be updated without proper class-changed method invokation.  The
worst part is you may not find out about it.  A necessary condition is to be
able to get hold of an obsolete version of a class before the class is changed.
     
     Proposal:
     
     Changing a class updates a database to allow the following generic
     functions to work.
     
     GET-OBSOLETE-VERSION class
      returns the preceding obsolete version of this class, or NIL if none.
     This allows users to define methods at any time on the obsolete class.
     Obsolete classes themselves may also have an obsolete-version.  Obsolete
     classes also respond to
     
     GET-UPDATED-VERSION obsolete-class
      with the next class or NIL
     This allows following the chain in the opposite direction
     
I don't have much objection to this.  However, I don't see it as sufficient to
implement the goals you agreed upon.  I see your proposal as a complement to
mine.

 (let ((obsolete-class
	 (cdr (assoc class (GET-OBSOLETE-CLASSES-FOR-REDEFINITION class )))))
   Add method on class-changes....
   redefine the class class ...
   (eq obsolete-class (GET-OBSOLETE-VERSION class)))
 
   => T

Patrick.