[Pharo-project] different behavior between Dictionary and MethodDictionary for #add:
Hi, I'm trying to test all subclasses of Dictionary and I just find a specific behavior for MethodDictionary : -> #add: return the association that has been added except for SmallDictionary for which #add: return the value of the association. Is there a reason for such an implementaion?
Same problem with #removeKey:ifAbsent that doesn't return anything for MethodDictionary ( instead of the value of association removed). 2009/6/29 Cyrille Delaunay <cy.delaunay@gmail.com>
Hi, I'm trying to test all subclasses of Dictionary and I just find a specific behavior for MethodDictionary :
-> #add: return the association that has been added except for SmallDictionary for which #add: return the value of the association.
Is there a reason for such an implementaion?
2009/6/29 Cyrille Delaunay <cy.delaunay@gmail.com>
Same problem with #removeKey:ifAbsent that doesn't return anything for MethodDictionary ( instead of the value of association removed).
2009/6/29 Cyrille Delaunay <cy.delaunay@gmail.com>
Hi,
I'm trying to test all subclasses of Dictionary and I just find a specific behavior for MethodDictionary :
-> #add: return the association that has been added except for SmallDictionary for which #add: return the value of the association.
*this is for MethodDictionary and not SmallDictionary
Is there a reason for such an implementaion?
Hi cyrille
Hi,
I'm trying to test all subclasses of Dictionary
cool.
and I just find a specific behavior for MethodDictionary :
-> #add: return the association that has been added except for SmallDictionary for which #add: return the value of the association.
I do not know. Does anybody know?
Is there a reason for such an implementaion?
probably lack of test reuse :) this is a good example showing that reusing tests using traits is a good way to offer consistent behavior.
-> #add: Â return the association that has been added except for SmallDictionary for which #add: return the value of the association.
I do not know. Does anybody know?
SmallDictionary is an optimized dictionary originally written for the refactoring browser. I does not use associations internally and thus it would probably lose some of its performance returning an association. Maybe this is also a left-over because that code was originally written on a different Smalltalk and inheriting from Dictionary seems to be a bit dangerous in such a case anyway. Lukas -- Lukas Renggli http://www.lukas-renggli.ch
participants (3)
-
Cyrille Delaunay -
Lukas Renggli -
Stéphane Ducasse