[Newbies] Re: Recap: How to empty a collection
blake at kingdomrpg.com
Tue Feb 19 22:58:45 UTC 2008
On Tue, 19 Feb 2008 14:20:51 -0800, Mathieu Suen <mathk.sue at gmail.com>
> On Feb 19, 2008, at 10:36 PM, Klaus D. Witzel wrote:
>> On Tue, 19 Feb 2008 22:14:49 +0100, Blake wrote:
>>> I've been following this debate with some interest, but I think it's
>>> gone beyond a noob discussion.
>>> Is there a noob answer to this question? There ought to be. I'm sort
>>> of leaning toward:
>>> Q. How do you empty a collection.
>>> A. You don't, you replace it with a new instance.
>>> Q. What if you have references to the collection in multiple places?
>>> A. Wrap the collection in another class, and reference that.
>> Q. can I use #become: instead of wrapper?
>> A. yes but the pro's don't like solutions with #become:, it smells
> and it's slow in Squeak.
Well, from what I was reading, "slow" and "smells" is putting it too
mildly. It sounds like it can corrupt your image, i.e., leave you with
non-working objects in unexpected places. I wouldn't even mention it.
More information about the Beginners