[Newbies] Proper object removal

Victor Rodriguez victorr at gmail.com
Wed Jun 4 12:21:33 UTC 2008



Rob Rothwell-2 wrote:
> 
> [snip]
>> DataManager>>deleteSelectedAbstractors
>>   self selected copy do: [:each |
>>   self abstractors remove: each.
>>   self selected remove: each.
>> ]
> 
> So...why would I use a copy (self selected copy) in this case?  Is that a
> clue to my misunderstanding?
> 

Because the copy of the collection will live only during the execution of
#do: and thus it won't hang on to references to your objects.

Saludos,

Victor Rodriguez.



> Rob
> 
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> 
> 

-- 
View this message in context: http://www.nabble.com/Proper-object-removal-tp17638745p17645408.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.



More information about the Beginners mailing list