<div dir="ltr">This extra check halves the speed of Dictionary&gt;&gt;= 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">&lt;<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>&gt;</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 &gt;&gt; #=, 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&gt;&gt;= (in category &#39;comparing&#39;) -----<br>
+ = anObject<br>
- = aDictionary<br>
        &quot;Two dictionaries are equal if<br>
         (a) they are the same &#39;kind&#39; of thing.<br>
         (b) they have the same set of keys.<br>
         (c) for each (common) key, they have the same value&quot;<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>
+       &quot;The two dictionaries may have different ideas about equal keys, so check both ways to avoid any inconsistency.&quot;<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>