>>>>> "Giuseppe" == Giuseppe Luigi Punzi Ruiz <
[hidden email]> writes:
Giuseppe> I need to delete all the instances of a class. I would like to know, wich is
Giuseppe> the best way to do this.
Giuseppe> I'm trying this:
Giuseppe> IGCompany allInstances do: [ :each | each := nil].
Giuseppe> But this, doesn't works.
Giuseppe> All help is appreciated.
"each := nil" changes the local variable "each" from containing an instance of
IGCompany to holding nil. That doesn't do anything to the original instance.
You need to find all of the objects *holding* these IGCompany instances and
tell them to let go. Once everyone has let go of all of them, then the next
garbage collection pass will see that nobody is pointing to them, and get rid
of them. In normal programming, this should just happen naturally.
The larger question is, why do you care? I hope you're not writing code that
looks like "IGCompany allInstances" for *real* code.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<
[hidden email]> <URL:
http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See
http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners