<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>I'm guessing</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">| ed id |</div><div id="AppleMailSignature">ed := Dictionary with: 'a' -> $a.</div><div id="AppleMailSignature">id<span style="background-color: rgba(255, 255, 255, 0);"> := IdentityDictionary with: 'a' copy -> $a.</span></div><div id="AppleMailSignature">{ ed = id. id = ed }<br><br><span style="background-color: rgba(255, 255, 255, 0);">_,,,^..^,,,_ (phone)</span></div><div><br>On Oct 12, 2015, at 5:14 PM, Chris Muller <<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">This extra check halves the speed of Dictionary>>= when they are equal, for all cases which consider equivalence symmetrical. If a=b, then it should be able to be assumed that b=a. What case is it not?</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 12, 2015 at 7:02 PM, <span dir="ltr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Levente Uzonyi uploaded a new version of Collections to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Collections-ul.668.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/trunk/Collections-ul.668.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Collections-ul.668<br>
Author: ul<br>
Time: 13 October 2015, 1:07:48.216 am<br>
UUID: 8abfa05a-70c6-4e38-bc00-7d665183106c<br>
Ancestors: Collections-ul.667<br>
<br>
In Dictionary >> #=, make sure that the dictionaries agree on what the common keys are. This way the behaviour of #= will be symmetric when the two dictionaries implement key equality differently.<br>
<br>
=============== Diff against Collections-ul.667 ===============<br>
<br>
Item was changed:<br>
----- Method: Dictionary>>= (in category 'comparing') -----<br>
+ = anObject<br>
- = aDictionary<br>
"Two dictionaries are equal if<br>
(a) they are the same 'kind' of thing.<br>
(b) they have the same set of keys.<br>
(c) for each (common) key, they have the same value"<br>
<br>
+ self == anObject ifTrue: [ ^true ].<br>
+ anObject isDictionary ifFalse: [ ^false ].<br>
+ self size = anObject size ifFalse: [ ^false ].<br>
+ self associationsDo: [ :association |<br>
+ (anObject at: association key ifAbsent: [ ^false ]) = association value<br>
+ ifFalse: [ ^false ] ].<br>
+ "The two dictionaries may have different ideas about equal keys, so check both ways to avoid any inconsistency."<br>
+ anObject associationsDo: [ :association |<br>
+ (self at: association key ifAbsent: [ ^false ]) = association value<br>
+ ifFalse: [ ^false ] ].<br>
+ ^true!<br>
- self == aDictionary ifTrue: [ ^ true ].<br>
- aDictionary isDictionary ifFalse: [^false].<br>
- self size = aDictionary size ifFalse: [^false].<br>
- self associationsDo: [:assoc|<br>
- (aDictionary at: assoc key ifAbsent: [^false]) = assoc value<br>
- ifFalse: [^false]].<br>
- ^true<br>
-<br>
- !<br>
<br>
<br>
</blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span></span><br></div></blockquote></body></html>