Lukas is speaking of default Collection>>removeAll which has few chances to work. But subclasses do a better job, that's why I did not bother... Cheers Nicolas 2009/12/5 Stéphane Ducasse <stephane.ducasse@inria.fr>:
this is strange since I recall nicolas or somebody proposing a real removalAll. So I would have thought it would work.
Stef
On Dec 5, 2009, at 5:49 PM, Lukas Renggli wrote:
SmallDictionary comes from the refactoring engine. It is a highly optimized dictionary originally intended for parse-tree matching. The method #empty does not make sense outside that context.
The method #removeAll is implemented in Collection. I don't think that this implementation can ever work in any concrete collection implementation, because it modifies the collection while iterating over it (lint would know that). Most classes override it with something sensible though.
Lukas
2009/12/5 Simon Denier <Simon.Denier@inria.fr>:
Stupid question: how do I remove all entities from a SmallDictionary
Let's take: d := SmallDictionary new. d add: $d -> 4. d add: $e -> 5. d
If I do d empty
then d size = 0 and d do: behaves as if there is nothing BUT someone can still perform d at: $d -> 5
If I do d removeAll
I get a MessageNotUnderstood: SmallInteger>>key because #removeAll inherited from Collection expects a different structure
-- Â Simon
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Lukas Renggli http://www.lukas-renggli.ch
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project