logo       

Re: Recap: How to empty a collection: msg#00160

lang.smalltalk.squeak.beginners

Subject: Re: Recap: How to empty a collection

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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise