[squeak-dev] The Trunk: Collections-cmm.984.mcz

Chris Muller asqueaker at gmail.com
Thu Feb 3 21:21:32 UTC 2022


Thanks for getting it going (and everything you do, frankly), this is an
important fix which I will also backport to 5.3.

 - Chris

On Thu, Feb 3, 2022 at 8:38 AM Marcel Taeumel <marcel.taeumel at hpi.de> wrote:

> Hi Chris --
>
> Thanks for improving this. I must have overlooked that PluggableDictionary
> implementation. Sorry. :-)
>
> Best,
> Marcel
>
> Am 02.02.2022 22:54:33 schrieb commits at source.squeak.org <
> commits at source.squeak.org>:
> Chris Muller uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-cmm.984.mcz
>
> ==================== Summary ====================
>
> Name: Collections-cmm.984
> Author: cmm
> Time: 2 February 2022, 3:54:20.944662 pm
> UUID: 88a7a4ca-9648-4dce-bb89-f9c857baec29
> Ancestors: Collections-mt.983
>
> - Avoid unnecessary garbage in #= for OrderedDictionary comparisons.
> - Delegate #species comparison via #=.
> - #hasEqualElements: API compatibility with SequenceableCollection.
>
> =============== Diff against Collections-mt.983 ===============
>
> Item was added:
> + ----- Method: OrderedDictionary>>hasEqualElements: (in category
> 'comparing') -----
> + hasEqualElements: anOrderedDictionary
> + "Answer whether my elements are the same as anOrderedDictionary, and in
> the same order."
> + | index |
> + self size = anOrderedDictionary size ifFalse: [ ^ false ].
> + index := 0.
> + self associationsDo:
> + [ : eachMyAssociation |
> + (anOrderedDictionary
> + atIndex: (index:=index+1)
> + ifAbsent: [ ^ false ]) = eachMyAssociation ifFalse: [ ^ false ] ].
> + ^ true!
>
> Item was changed:
> ----- Method: PluggableDictionary>>= (in category 'comparing') -----
> = anObject
> "Two dictionaries are equal if
> (a) they are the same 'kind' of thing.
> (b) they have the same set of keys.
> (c) for each (common) key, they have the same value"
>
> self == anObject ifTrue: [ ^true ].
> + self species = anObject species ifFalse: [ ^false ].
> - self species == anObject species ifFalse: [ ^false ].
> hashBlock = anObject hashBlock ifFalse: [ ^false ].
> equalBlock = anObject equalBlock ifFalse: [ ^false ].
> + ^ self hasEqualElements: anObject!
> - self size = anObject size ifFalse: [ ^false ].
> - self associationsDo: [ :association |
> - (anObject at: association key ifAbsent: [ ^false ]) = association value
> - ifFalse: [ ^false ] ].
> - ^true!
>
> Item was added:
> + ----- Method: PluggableDictionary>>hasEqualElements: (in category
> 'comparing') -----
> + hasEqualElements: aDictionary
> + "Answer whether my elements are the same as those of aDictionary."
> + self size = aDictionary size ifFalse: [ ^ false ].
> + self associationsDo:
> + [ : association |
> + (aDictionary
> + at: association key
> + ifAbsent: [ ^ false ]) = association value ifFalse: [ ^ false ] ].
> + ^ true!
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220203/dde04307/attachment.html>


More information about the Squeak-dev mailing list