[BUG]Collection>>removeAll:
Stephan Rudlof
sr at evolgo.de
Wed Aug 28 14:20:55 UTC 2002
Richard A. O'Keefe wrote:
> "David Griswold" <David.Griswold at acm.org> wrote:
<snipped>
> The main reason that I can think of is Smalltalk's dependency mechanism.
> If I have a changing collection which is being "watched" by some receiver
> (quite a reasonable thing to do) then creating a new empty collection
> instead of emptying the old one would be the wrong thing to do.
>
> Another argument that might be made is
> that people need a generally easy way of removing all of a collection's
> elements, but I don't buy that because most of the time, they should
> just create a new empty collection, which is usually faster, so we don't
> want to particularly encourage doing #removeAll anyway, since it is
> usually the slowest way to get the job done.
>
> Speed isn't my issue. Preserving identity so that the Observer pattern
> continues to work is my issue.
Alternative: Use of a value holder (preserving identity) holding the
collection and the dependency mechanism.
Greetings,
Stephan
<snipped>
--
Stephan Rudlof (sr at evolgo.de)
"Genius doesn't work on an assembly line basis.
You can't simply say, 'Today I will be brilliant.'"
-- Kirk, "The Ultimate Computer", stardate 4731.3
More information about the Squeak-dev
mailing list
|