[Newbies] How to empty a collection?

Marcin Tustin mm3 at zepler.net
Tue Feb 19 09:53:56 UTC 2008


On Feb 19, 2008 2:29 AM, Ron Teitelbaum <Ron at usmedrec.com> wrote:

> 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


Re-initialize how? I can't see a way to run object initialisation over again
on an existing object.


> 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
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20080219/bd2fd748/attachment.htm


More information about the Beginners mailing list