[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Class Redefinition
- To: common-lisp-object-system@SAIL.STANFORD.EDU
- Subject: Class Redefinition
- From: Dick Gabriel <RPG@SAIL.STANFORD.EDU>
- Date: 24 Jul 87 1645 PDT
The problem with class redefinition is that the updating of instances can
be caused by arbitrary events, as far as the user is concerned. If none of
DEFCLASS, ADD-METHOD, MAKE-METHOD, CLASS-NAMED, the evaluation of the
special form FUNCTION, and garbage collection can update instances, then
if a CLOS implementation does not have multitasking, the following will
work (or something like it):
(let ((obsolete-class (class-named 'heh-heh)))
(defclass heh-heh ...)
(add-method
#'class-changed
(make-method ;later, make-instance
()
`(,obsolete-class ,(class-named 'heh-heh))
#'...)))
If there is a CLOS implementation with all of the properties named
above except it does have multitasking (including incremental GC),
then some form or macro like ATOMICALLY wrapped around the above
will work.
Something like this should work:
(let
((obsolete-class (class-named 'heh-heh))
(new-class (make-instance 'standard-class ...))) ;make an anonymous class
;that is the new HEH-HEH
(add-method
#'class-changed
(make-method ;later, make-instance
()
`(,obsolete-class ,new-class)
#'...))
(name-that-class new-class 'heh-heh)) ;Hm, what is this function?
I think, though, that it probably makes sense to have Danny's version
of GET-OBSOLETE-CLASS for the same reason that I don't like UNIX - it's
too easy to do a DEFCLASS of an existing class and then wish you
had a handle on the old one. I think we need to decide whether Patrick's
versions of getting obsolete classes are worth having around to simplify
life.
I think we forgot to define NAME-THAT-CLASS. It should be the thing such
that MAKE-INSTANCE + (<the thing> <name>) = (DEFCLASS NAME ...).
-rpg-