[comp.lang.smalltalk] Class deletion in Digitalk's Smalltalk/V

chouc@mist.cs.orst.edu (Chou Chung-Di) (02/15/90)

Could anyone help me on this problem?

Digitalk's Smalltalk/V supports a funtion to remove global variables using
the following expression:

    Smalltalk removeKey: #AGlobalVariable.

Or, I can inspect the dictionary and explicit remove the key associated with
the object. But I encountered a problem - how do I delete a class?

If SomeClass exists and I want to delete it from the system, I can remove it
and it seems that SomeClass is no longer defined in Smalltalk. But when I go
to my class hierarch browser, I'll still see it there, but with class 
definition same as that of an UndefinedObject. Later, when I retrieve the
class definition file of SomeClass, I'll find two entries in my class 
hierarchy browser for SomeClass - with the same new definition.

I notice there is a way in Smalltalk/V 286 that you can delete a class. 
Actually its name will still be posted in the class hierarchy browser, but
you cannot access it - it becomes an instance of non-existent class. 
What's wrong with this?

MUHRTH@tubvm.cs.tu-berlin.de (Thomas Muhr) (02/23/90)

In article <15859@orstcs.CS.ORST.EDU>, chouc@mist.cs.orst.edu (Chou Chung-Di)
says:
>
>Could anyone help me on this problem?
>
>Digitalk's Smalltalk/V supports a funtion to remove global variables using
>the following expression:
>
>    Smalltalk removeKey: #AGlobalVariable.
>
>Or, I can inspect the dictionary and explicit remove the key associated with
>the object. But I encountered a problem - how do I delete a class?
>
>If SomeClass exists and I want to delete it from the system, I can remove it
>and it seems that SomeClass is no longer defined in Smalltalk. But when I go
>to my class hierarch browser, I'll still see it there, but with class
>definition same as that of an UndefinedObject. Later, when I retrieve the
>class definition file of SomeClass, I'll find two entries in my class
>hierarchy browser for SomeClass - with the same new definition.
>
>I notice there is a way in Smalltalk/V 286 that you can delete a class.
>Actually its name will still be posted in the class hierarchy browser, but
>you cannot access it - it becomes an instance of non-existent class.
>What's wrong with this?
Nothing! There is more to class deletion than just removing the entry in
the dictionary of global vars 'Smalltalk'. Only use the classbrowsers
remove subclass method for class removal. This happened to me too accident-
ly when I established a global var which happened to be a class identifier
also (Smalltalk doesn't ask you anything in this case, because it doesn'
t check the used varname not to be a class name!). To make the class deletion
complete you have to remove the resembling entry from the collection of all
classes.
So long - Thomas.
PS.: BTW, can somebody give a lecture about the class DeletedClass ? Seems to
     be at least a sign of trouble, when you get messages about it.....