caw@munnari.oz.au (Chris Wright) (12/24/90)
I've partially solved my problem with the sorted collection, by over-riding the select method and doing something like this: select : aBlock ^ ((self asArray) select: aBlock) SortedCollection: (self sortBlock). Now I've another question: how (in st/v) do you find the NAMES of instances of a class so that I can set them to nil, and delete the class. AllInstances returns an array of instances, but the NAME of the instance (often a global) is not returned. Thanks for your help chris ************* chris wright -- st. vincen't hospital, melbourne -- a guest on melb university system
MUHRTH@tubvm.cs.tu-berlin.de (Thomas Muhr) (12/24/90)
In article <6342@munnari.oz.au>, caw@munnari.oz.au (Chris Wright) says: > >Now I've another question: > how (in st/v) do you find the NAMES of instances of a class > so that I can set them to nil, and delete the class. > AllInstances returns an array of instances, but the NAME of the > instance (often a global) is not returned. > There are 2 methods to get rid of instances: 1. Set all instances to an empty String (the dirty method) 2. Trace all references of the objects (the clean but long way) Objects do not necessarily have NAMES. They are referenced by other objects. When the last reference is deleted, the garbage collector comes into action. If you do not want to go on working with a possibly corrupted image, don't use method 1! Instances can be referenced by processes which can then point to nirwana, which at some point of calculation can result in system crashes. To use method 2, inspect all references: XYZClass allInstances first allReferences inspect The elements of the resulting array can than be traced in the same way. The tree which you have to traverse can be rather deep and wide branched. As references you don't have names but very often your instances are elements of other arrays, collections, which themselves are elements of.... When you come across a dictionary, which holds your reference you can remove the latter easily. Before starting, think of global or class variables, where instances might be bound. For instance, panes often are stuck in the dependents variable which can be emptied by Object initDependents. This happens very often, when opening an application gets interrupted. Hope this helps a little. - Thomas ------- Thomas Muhr, Technical University of Berlin, BITNET: muhrth@db0tui11 Project ATLAS - Computer Based Tools for Qualitative Research "Computers, like every technology, are a vehicle for the transformation of tradition." (WINOGRAD/FLORES)