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

CLOS question

    Date: Tue, 7 May 1991 18:08 EDT
    From: curte@beowulf.Jpl.Nasa.Gov (Curt Eggemeyer)

    How does one dynamically remove CLASSES. I see how you transform a
    CLASS but I wished to remove a CLASS and its associated instances
    from my LISP world.  Is there a function to do so.  If not, do I
    have to transform it by redefining it to the standard-class (how?)?

X3J13 addressed this issue at its June, 1990 meeting (after CLtL2 went
to press, for those of you who are searching for proof that CLtL2 is
distinct from the evolving ANSI spec).  Issue SETF-FIND-CLASS, which passed
by unanimous vote, made the following change:

  Define (SETF (FIND-CLASS 'FOO) NIL) to cause FOO no longer to name a class.
  If FOO already does not name a class, the operation has no effect.

  This does not affect the class formerly named by FOO, if any, except that
  if FOO was that class's proper name, the class no longer has a proper name.

In case you're wondering how portable this is, the `current practice'
section of the issue writeup for SETF-FIND-CLASS offered the following clues:

  Symbolics Genera 8.0, TI Explorer release 6.0, and Lucid 4.0.0 Beta-1
  implement the proposal.  Other CLOS implementations were not surveyed.

Note well that according to this, existing instances (and, in fact, the
class object itself) are not changed.  The instances and the class will be 
removed by the  garbage collector if there are no more pointers to it.

In practice, I don't know how likely it is that there will be no
pointers, given that the class system itself probably still has pointers
in order to implement inheritance.  But in any case, except that the old
class and instances may still be taking up storage, the program-visible
effect of doing this SETF should be equivalent to what you're asking for.