Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!helios!cs.tamu.edu From: terry@cs.tamu.edu (Terry Escamilla) Newsgroups: comp.lang.smalltalk Subject: Help with perplexing Smalltalk question Message-ID: <11770@helios.TAMU.EDU> Date: 4 Feb 91 17:23:13 GMT Sender: usenet@helios.TAMU.EDU Distribution: usa Organization: Computer Science Department, Texas A&M University Lines: 62 Hello. I ran into a few problems with ST v/286 while working at home last night. (1) How do you get rid of Global Variables? I created a global var as an instance of a class. When I tried to modify the class, ST claimed I couldn't because my class had instances. I tried a series of mistakes as indicated below. (2) First I tried 'Smalltalk at: #VarName put: nil'. But that didn't solve the problem. I think it removed the relationship link from VarName to the class, but not vice versa. So my class still thought it had some instances. (3) Then I tried 'Smalltalk removeKey: #VarName' which screwed up everything. I had to reload the system and fileIn all of the classes I had written. (4) By accident, I removed the name of one of my subclasses from the Smalltalk system dictionary. However, in the ClassBrowser, the parent class still was linked to that subclass. Clicking on the subclass name in the ClassBrowser resulted in an error message telling me that the subclass did not exist (even though it shows in the Browser list for the parent class). So, there's no way to stop the subclass from showing up in the Browser. Any way to fix this? I've decided to avoid global variables all together because I could never figure out a way to disassociate a global variable from the class it was created from. Here are a few other questions. (5) Is there any way to find out the names of all the global variables the system knows? I apparently forgot some (and had already compressed the change log), so it was impossible for me to remove them because I didn't know their names. (6) Back to (1) above, even if you know the name of a global var, how do you delete it? (7) Is there any way to delete the instances which a class has? I tried a bunch of different ways to inspect the class, but could never get a useful list of current instances for that class. If I'd found the instances list and modified it, would that have caused some dangling pointers anywhere? (8) If there are some instances of a class, and you want to change the class, the instances must somehow be deallocated. If they are global variables, is there a way to de-reference them from the class without removing them from the system dictionary? Thanks for any insight on this murky matter. Terry Escamilla terry@cs.tamu.edu