From: WoodHacker
Subject: Deleting a class
Date: 
Message-ID: <1141655999.797720.255840@v46g2000cwv.googlegroups.com>
I have a case where a user creates a temporary class, uses it, and then
discards it.   I want to completely delete the class from the system.
 It's possible that the user might come back and create the same class
over again immediately (with the same values) and I want the old class
and it's members to be completely gone.

Can anyone explain to me how you free/remove/delete a class?

Bill

From: Bill Atkins
Subject: Re: Deleting a class
Date: 
Message-ID: <874q2bh335.fsf@rpi.edu>
"WoodHacker" <·······@comcast.net> writes:

> I have a case where a user creates a temporary class, uses it, and then
> discards it.   I want to completely delete the class from the system.
>  It's possible that the user might come back and create the same class
> over again immediately (with the same values) and I want the old class
> and it's members to be completely gone.
>
> Can anyone explain to me how you free/remove/delete a class?
>
> Bill

I'm not sure how to completely remove a class from the system.  You
can break the association between its name and the actual class
object, or even redefine the class to have no slots, but there will
always be ways for the user to hang on to a class object.  So I guess
it's time to invoke the Fundamental Question of Usenet: why do you
want this?  :-)

Bill
From: Pascal Costanza
Subject: Re: Deleting a class
Date: 
Message-ID: <4730t0Fdhe8iU1@individual.net>
WoodHacker wrote:
> I have a case where a user creates a temporary class, uses it, and then
> discards it.   I want to completely delete the class from the system.
>  It's possible that the user might come back and create the same class
> over again immediately (with the same values) and I want the old class
> and it's members to be completely gone.
> 
> Can anyone explain to me how you free/remove/delete a class?

(setf (find-class 'some-class) nil)

As long as instances of that class still exist, the class will still be 
available, but it cannot be found anymore. A new class under the old 
name will be a completely new class.


Pascal

-- 
My website: http://p-cos.net
Closer to MOP & ContextL:
http://common-lisp.net/project/closer/
From: ··@codeartist.org
Subject: Re: Deleting a class
Date: 
Message-ID: <1141663892.082645.228030@z34g2000cwc.googlegroups.com>
Pascal Costanza schrieb:

> As long as instances of that class still exist, the class will still be
> available, but it cannot be found anymore. A new class under the old
> name will be a completely new class.

One possibility to handle those instances is to use CHANGE-CLASS on
them to change their class to something like

(defclass obsolete-instance ()())

This should also make it possible that the garbage collector can
collect the old class.

ciao,
Jochen
From: Tim Bradshaw
Subject: Re: Deleting a class
Date: 
Message-ID: <1141667366.132697.299770@p10g2000cwp.googlegroups.com>
··@codeartist.org wrote:

>
> This should also make it possible that the garbage collector can
> collect the old class.

But it won't, because all the superclasses will still have references
to it.  To delete a class you need to do a fair amount of MOP stuff.
Or, in other words, you can't.

--tim