[Newbies] Re: Recap: How to empty a collection
nicolas cellier
ncellier at ifrance.com
Wed Feb 20 22:05:47 UTC 2008
Klaus D. Witzel a écrit :
> On Wed, 20 Feb 2008 02:01:49 +0100, nicolas cellier wrote:
>
>> Some proposed an alternative based on (self removeAll: self), and
>> started writing optimized versions of #removeAll:.
>
> No, (anOrderedCollection removeAll: anOrderedCollection) was not
> optimized. It had a *very* long known bug, which was fixed. Please do
> less mixing of subjects in threads.
>
OK, I'm extrapolating.
In this case, while you are at it:
| aSet |
aSet :='Klaus' asSet.
aSet removeAll: aSet.
aSet
| aHeap |
aHeap := Heap withAll: 'Witzel'.
aHeap removeAll: aHeap.
aHeap
I would have used my name, but it seems i am removeable ;-)
| aSet |
aSet :='Cellier' asSet.
aSet removeAll: aSet.
aSet
Try with the collection of your choice.
In the mean time, don't use (self removeAll: self)...
Yes i'm mixing threads,should be How to NOT empty a collection ;-)
Nicolas
>> I think our biggest problem is that we have plenty possible ways to do
>> it... Finding a balance between genericity and efficiency...
>
> No, more correctness at the price of less efficiency :)
>
>> Nicolas
Agree on this one.
Then allow removeAllSuchThat: as default implementation.
Nicolas
More information about the Beginners
mailing list