<!-- 
RSS generated by JIRA (4.4#649-r158309) at Tue Jun 18 19:01:28 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://dev.clojure.org/jira/si/jira.issueviews:issue-xml/CLJ-1106/CLJ-1106.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Clojure JIRA</title>
    <link>http://dev.clojure.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>4.4</version>
        <build-number>649</build-number>
        <build-date>25-07-2011</build-date>
    </build-info>

<item>
            <title>[CLJ-1106] Broken equality for sets</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-1106</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;Equality for sets is not consistent with other persistent collections when the hashCode differs:&lt;/p&gt;

&lt;p&gt;(= {(Integer. -1) :foo} {(Long. -1) :foo})&lt;br/&gt;
=&amp;gt; true&lt;/p&gt;

&lt;p&gt;(= &lt;span class=&quot;error&quot;&gt;&amp;#91;(Integer. -1)&amp;#93;&lt;/span&gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;(Long. -1)&amp;#93;&lt;/span&gt;)&lt;br/&gt;
=&amp;gt; true&lt;/p&gt;

&lt;p&gt;(= #{(Integer. -1)} #{(Long. -1)})&lt;br/&gt;
=&amp;gt; false&lt;/p&gt;

&lt;p&gt;Attached is what I believe to be a basic fix. It removes a hashCode check from APersistentSet.equals. A similar check was removed from APersistentMap in the following commit:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/clojure/clojure/commit/b5f5ba2e15dc2f20e14e05141f7de7c6a3d91179&quot;&gt;https://github.com/clojure/clojure/commit/b5f5ba2e15dc2f20e14e05141f7de7c6a3d91179&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this patch, set equality works as expected and all tests pass.&lt;/p&gt;

&lt;p&gt;My understanding of the implications of this change are limited, so someone more knowledgeable would need to chime in about its correctness.&lt;/p&gt;</description>
                <environment></environment>
            <key id="15818">CLJ-1106</key>
            <summary>Broken equality for sets</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="3" iconUrl="http://dev.clojure.org/jira/images/icons/priority_major.gif">Major</priority>
                    <status id="6" iconUrl="http://dev.clojure.org/jira/images/icons/status_closed.gif">Closed</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="aaron">Aaron Bedra</assignee>
                                <reporter username="jkkramer">Justin Kramer</reporter>
                        <labels>
                    </labels>
                <created>Fri, 9 Nov 2012 09:42:48 -0600</created>
                <updated>Fri, 1 Mar 2013 09:49:21 -0600</updated>
                    <resolved>Fri, 8 Feb 2013 07:31:35 -0600</resolved>
                            <version>Release 1.4</version>
                <version>Release 1.5</version>
                                <fixVersion>Release 1.5</fixVersion>
                                        <due></due>
                    <votes>4</votes>
                        <watches>6</watches>
                        <comments>
                    <comment id="29926" author="jafingerhut" created="Fri, 9 Nov 2012 09:48:32 -0600"  >&lt;p&gt;Can you add some unit tests that fail with the current code but succeed with the change?&lt;/p&gt;</comment>
                    <comment id="29927" author="jkkramer" created="Fri, 9 Nov 2012 10:24:55 -0600"  >&lt;p&gt;Revised patch with unit test that fails in master and succeeds with patch&lt;/p&gt;</comment>
                    <comment id="30150" author="halgari" created="Mon, 3 Dec 2012 09:04:02 -0600"  >&lt;p&gt;vetting&lt;/p&gt;</comment>
                    <comment id="30508" author="gfredericks" created="Tue, 29 Jan 2013 17:32:14 -0600"  >&lt;p&gt;This came up when we were trying to diff two datasets by putting them in sets and comparing. We had Integers because they came back from JDBC that way.&lt;/p&gt;</comment>
                    <comment id="30509" author="aaron" created="Tue, 29 Jan 2013 17:35:36 -0600"  >&lt;p&gt;I&apos;m going to take a look and try to get this shipped. It hit us and I would love to to see it in 1.5&lt;/p&gt;</comment>
                    <comment id="30510" author="pjstadig" created="Tue, 29 Jan 2013 19:14:37 -0600"  >&lt;p&gt;I applied the patch on master (ca465d6d) and it applied cleanly and fixes the issue.&lt;/p&gt;</comment>
                    <comment id="30515" author="bjeanes" created="Wed, 30 Jan 2013 11:19:41 -0600"  >&lt;p&gt;Instead of removing &lt;tt&gt;m.hashCode() != hashCode()&lt;/tt&gt;, perhaps we should use `Util.hasheq()` instead. It already seems to special case numbers (&lt;a href=&quot;https://github.com/clojure/clojure/blob/f48d024e97/src/jvm/clojure/lang/Util.java#L164-L172&quot;&gt;https://github.com/clojure/clojure/blob/f48d024e97/src/jvm/clojure/lang/Util.java#L164-L172&lt;/a&gt;) and won&apos;t have the potential performance impact that skipping hashCode checks could bring.&lt;/p&gt;</comment>
                    <comment id="30516" author="bjeanes" created="Wed, 30 Jan 2013 11:39:30 -0600"  >&lt;p&gt;Attaching a patch with an alternate fix for this issue that does not skip hashCode checking.&lt;/p&gt;

&lt;p&gt;It passes all existing tests and fixes this issue.&lt;/p&gt;

&lt;p&gt;I want to benchmark the difference, too.&lt;/p&gt;</comment>
                    <comment id="30517" author="bjeanes" created="Wed, 30 Jan 2013 13:32:08 -0600"  >&lt;p&gt;On further thought and comparison to &lt;tt&gt;APersistentMap&lt;/tt&gt;, I&apos;m not sure if that&apos;s the best use of &lt;tt&gt;Util.hasheq()&lt;/tt&gt;. I can&apos;t find good reference on the semantic differences and am not familiar enough with the Clojure source to infer it, yet.&lt;/p&gt;</comment>
                    <comment id="30529" author="aaron" created="Sat, 2 Feb 2013 12:33:12 -0600"  >&lt;p&gt;Bo, I don&apos;t see you listed on the contributors list. Did you send in a CA?&lt;/p&gt;</comment>
                    <comment id="30530" author="aaron" created="Sat, 2 Feb 2013 13:36:27 -0600"  >&lt;p&gt;Both of the patches above are not complete. APersistentSet equiv calls equals. APersistentMap has two separate ways of handling this. This is the path that the fix should take.&lt;/p&gt;</comment>
                    <comment id="30531" author="aaron" created="Sat, 2 Feb 2013 14:37:29 -0600"  >&lt;p&gt;This patch addresses the difference between equals and equiv.&lt;/p&gt;</comment>
                    <comment id="30549" author="stu" created="Mon, 4 Feb 2013 21:55:56 -0600"  >&lt;p&gt;The Set equality code currently in Clojure uses .hashCode to quickly bail out of comparisons in both .equals and .equiv. This feels wrong since .equals and .equiv presume different hashes. The map equality code avoids the problem by not checking any hash.&lt;/p&gt;

&lt;p&gt;Aaron&apos;s 2/13 patch makes set equality work like map equality, not checking the hash. (I think a much shorter patch that accomplishes the same thing merely drops the call to hash.)&lt;/p&gt;

&lt;p&gt;It seems to me a separate problem that both hash and set are broken for Java .equals rules, because of the equiv-based handling of their keys.&lt;/p&gt;

&lt;p&gt;I think this needs more consideration.&lt;/p&gt;</comment>
                    <comment id="30552" author="stu" created="Tue, 5 Feb 2013 08:57:10 -0600"  >&lt;p&gt;Notes from discussion with Rich:&lt;/p&gt;

&lt;p&gt;1. Aaron&apos;s 2/2/13 patch, which mimics map logic into set, is the preferred approach.&lt;/p&gt;

&lt;p&gt;2. The broader issue I was worried about is the semantic collision between Map&apos;s containsKey and Associative&apos;s containsKey. This is out of scope here, and perhaps ever.&lt;/p&gt;</comment>
                    <comment id="30553" author="aaron" created="Tue, 5 Feb 2013 09:38:48 -0600"  >&lt;p&gt;Any chance this will make 1.5?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11825" name="0001-CLJ-1106-Use-Util.hasheq-in-hashCode-for-persistent-.patch" size="772" author="bjeanes" created="Wed, 30 Jan 2013 11:39:30 -0600" />
                    <attachment id="11829" name="0001-Fixing-set-equality.patch" size="2640" author="aaron" created="Sat, 2 Feb 2013 14:37:29 -0600" />
                    <attachment id="11669" name="setequals.diff" size="1672" author="jkkramer" created="Fri, 9 Nov 2012 10:24:55 -0600" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                <customfield id="customfield_10002" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Approval</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10007">Ok</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                    <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                            <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Patch</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10002">Code and Test</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                        </customfields>
    </item>
</channel>
</rss>