[Newbies] How to empty a collection?

Ron Teitelbaum Ron at USMedRec.com
Tue Feb 19 02:29:09 UTC 2008


Hi Marcin,

I'm not a fan of using #become.  I will use it for very specific behavior
when I need to retain pointers to an object.  For example for implementing a
proxy.  In that case become is a very useful tool.  I think that #become is
overkill for this situation, but I won't argue that it doesn't work.  In
most cases you have a well encapsulated collection.  That collection is not
referenced outside the object so you can just reinitialize your collection
without #become.  If it is complicated enough to worry about pointers I
wouldn't use #become.  Someone will get lost and miss your #become hidden
inside #removeAll: .  I'm not saying this will cause problems but I think I
would rather work with the collection directly instead of using the #become.

Also if you are working on a collection that is large enough to worry about
performance then you are probably missing a database that would
significantly improve your performance.  

Ron Teitelbaum



________________________________________
From: beginners-bounces at lists.squeakfoundation.org
[mailto:beginners-bounces at lists.squeakfoundation.org] On Behalf Of Marcin
Tustin
Sent: Monday, February 18, 2008 8:43 PM
To: A friendly place to get answers to even the most basic questions
aboutSqueak.
Subject: Re: [Newbies] How to empty a collection?

My own testing suggests that references to the object remain in place. I
would guess that that is the whole point of become.
On Feb 19, 2008 1:38 AM, cdrick <cdrick65 at gmail.com> wrote:
> Isn't Cedrick's aida solution going to be significantly faster?
>
this is not mine :)

butI'd interested to see if it's a good use of #become:... Does it
keep references ? is it safe ?

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




More information about the Beginners mailing list