[ENH][BUG][FIX] Dictionary>>addAll: (was: Enhancements to Collection from RB)

Adrian Lienhard adi at netstyle.ch
Sat Dec 13 17:52:36 UTC 2003


Hi Marcus and collection users

The #, doesn't work for dictionaries because #, uses Collection>>addAll:
which is broken for Dictionaries: It iterates with #do: over the other
collection. Now, Dictionary>>do: doesn't iterate over it's associations (as
I would expect) but over its values!

Collection>>addAll: aCollection says in it's comments:
"Include all the elements of aCollection as the receiver's elements. Answer
 aCollection. Actually, any object responding to #do: can be used as
argument."

...which does not hold for Dictionary

Since we probably do not want to change (high impact...) the behavior of
Dictionary>>do: (which is in my eyes not properly implemented because it
changes the semantics), I've implemented Dictionary>>addAll: which overrides
the method from Collection and iterates with #associationDo: over it's
elements.

#addAll: by the way, also breaks in visualworks... Ansi Smalltalk although
specifies an addAll: for dictionaries.

The new attached changeset should make the enhancement for #, work plus
#addAll: for dictionaries.

Cheers,
Adrian

Marcus Denker wrote:
>> Am 12.12.2003 um 16:36 schrieb Adrian Lienhard:
>>
>>> Resent changeset with Collection>>, only
>>>
>> ... and yet again for BFAV without the Re: in the subject ;-)
>
>
>
>>
>>
>> --
>> Marcus Denker marcus at ira.uka.de

_____________________
Adrian Lienhard
www.adrian-lienhard.ch
www.netstyle.ch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CollectionEnh.3.cs
Type: application/octet-stream
Size: 481 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20031213/540d6dad/CollectionEnh.3.obj


More information about the Squeak-dev mailing list