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

Class redefinition and class-changed.



Redefining a class will provoke instances of this class to be changed to the new
class using the change-class protocol.  However there is no specified way to
take advantage of the class-changed generic function.

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.

Proposal:

Before committing the class to redefinition, we specify a way to get the
obsolete class objects and thus, define methods for class-changed.  Since a
class redefinition will propagate down, it will be useful to get the closure of
all the redefintions.

GET-OBSOLETE-CLASSES-FOR-REDEFINITION will return an alist whose keys are the
classes implicated in the class-redefinition of CLASS and whose contents are the
obsolete classes.

Syntax:
GET-OBSOLETE-CLASSES-FOR-REDEFINITION CLASS &optional (REDEFINITION-CLOSURE-P t)

GET-OBSOLETE-CLASSES-FOR-REDEFINITION is a generic function.

CLASS is a class object 

if REDEFINITION-CLOSURE-P not provided or non nil, all the classes implicated in
the class redefinition of CLASS are returned as keys of the resulting alist.  If
REDEFINITION-CLOSURE-P is nil, then the alist returned contains only one entry
for CLASS.

Besides obsolete class creation, get-obsolete-classes-for-redefinition does not
side effect.  In other words, it it OK to call it more than once and the returned
obsolete classes are EQ from one call to the other.

Once the methods are defined, the class redefinition can be executed.

Patrick.