<!-- 
RSS generated by JIRA (4.4#649-r158309) at Wed Jun 19 12:52:35 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-736/CLJ-736.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-736] Docstring of defrecord (and =) does not correctly describe equality behavior for records. </title>
                <link>http://dev.clojure.org/jira/browse/CLJ-736</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;&lt;a href=&quot;http://groups.google.com/group/clojure/browse_frm/thread/eba691b38c45196b#&quot;&gt;http://groups.google.com/group/clojure/browse_frm/thread/eba691b38c45196b#&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The docstring of defrecord says it &quot;will define type-and- &lt;br/&gt;
value-based equality and hashCode&quot;.   In reality, record types are included in = but not .equals (or hashCode), and so records of different types can collide as map keys.   &lt;/p&gt;

&lt;p&gt;Along the same lines, the docstring of = says &quot;same as Java x.equals&lt;img class=&quot;emoticon&quot; src=&quot;http://dev.clojure.org/jira/images/icons/emoticons/thumbs_up.gif&quot; height=&quot;19&quot; width=&quot;19&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;, except it ... compares numbers and collections in a type-independent manner&quot;.   To me, this seems to imply the opposite of what actually happens with records. &lt;/p&gt;

&lt;p&gt;FWIW I think it would be more clear if the behavior for = and .equals were the same in this respect, but in any case the implemented behavior should be properly documented.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14349">CLJ-736</key>
            <summary>Docstring of defrecord (and =) does not correctly describe equality behavior for records. </summary>
                <type id="4" iconUrl="http://dev.clojure.org/jira/images/icons/improvement.gif">Enhancement</type>
                                <priority id="4" iconUrl="http://dev.clojure.org/jira/images/icons/priority_minor.gif">Minor</priority>
                    <status id="6" iconUrl="http://dev.clojure.org/jira/images/icons/status_closed.gif">Closed</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="stu">Stuart Halloway</assignee>
                                <reporter username="jawolfe">Jason Wolfe</reporter>
                        <labels>
                    </labels>
                <created>Wed, 9 Feb 2011 18:00:40 -0600</created>
                <updated>Fri, 1 Mar 2013 12:47:03 -0600</updated>
                    <resolved>Fri, 2 Sep 2011 09:39:50 -0500</resolved>
                            <version>Release 1.2</version>
                <version>Release 1.3</version>
                <version>Release 1.4</version>
                                <fixVersion>Release 1.3</fixVersion>
                <fixVersion>Release 1.4</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="26493" author="stuart.sierra" created="Mon, 6 Jun 2011 09:37:25 -0500"  >&lt;p&gt;Also discussed at &lt;a href=&quot;https://groups.google.com/d/topic/clojure/e6UhXVny8Xc/discussion&quot;&gt;https://groups.google.com/d/topic/clojure/e6UhXVny8Xc/discussion&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Per Rich, &quot;The policy is: = includes the type and .equals doesn&apos;t. In this way records can still be proper j.u.Maps and = remains most useful for records (e.g. including type).&quot;&lt;/p&gt;</comment>
                    <comment id="26494" author="jawolfe" created="Mon, 6 Jun 2011 11:25:25 -0500"  >&lt;p&gt;On a related note:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://dev.clojure.org/display/doc/Enhanced+Primitive+Support?focusedCommentId=1573146#comment-1573146&quot;&gt;http://dev.clojure.org/display/doc/Enhanced+Primitive+Support?focusedCommentId=1573146#comment-1573146&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Regarding &quot;hash maps and sets now use = for keys ... will use stricter .equals when calling through java.util interfaces&quot;:&lt;/p&gt;

&lt;p&gt;Note that &quot;=&quot; is actually stricter than &quot;.equals&quot; for record types currently, because it includes type information.&lt;/p&gt;

&lt;p&gt;This has important consequences for how (and whether) hash maps and sets actually obey the java.util interfaces.&lt;/p&gt;

&lt;p&gt;For instance, if &lt;/p&gt;

&lt;p&gt;(defrecord P []), ...&lt;/p&gt;

&lt;p&gt;what should (.get {(P.) 1 (Q.) 2} (Q.)) return?  How about if we .get an element of a third type (R.)?&lt;br/&gt;
&lt;br/&gt;
In a similar vein, this behavior seems confusing at best:&lt;br/&gt;
&lt;br/&gt;
user=&amp;gt; (java.util.HashMap. {(P.) 1 (Q.) 2})&lt;br/&gt;
#&amp;lt;HashMap {user.P@0=2}&amp;gt;&lt;/p&gt;</comment>
                    <comment id="26538" author="aaron" created="Tue, 28 Jun 2011 18:36:32 -0500"  >&lt;p&gt;Open question:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;the phrase &quot;type-independent&quot; is confusing. It is intended to talk about concrete numeric and collection types, but I can see why it gets confusing with records. Need an idea for two different terms here (and define them someplace). If somebody has one, please add it to this ticket.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Non-issues:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;= and .equals are not and will not be the same. The whole point is to avoid Java&apos;s broken semantics (=) while providing an interop formula for those who need it (.equals)&lt;/li&gt;
	&lt;li&gt;Any types can collide as hash keys.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                    <comment id="26724" author="aaron" created="Fri, 19 Aug 2011 11:34:39 -0500"  >&lt;p&gt;Any thoughts on the open questions part Rich?&lt;/p&gt;</comment>
                    <comment id="26752" author="stu" created="Fri, 2 Sep 2011 09:37:00 -0500"  >&lt;p&gt;I think the following is better:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;monospaced&lt;/tt&gt;&lt;br/&gt;
  In addition, defrecord will define type-and-value-based =,&lt;br/&gt;
  and will defined Java .hashCode and .equals consistent with the&lt;br/&gt;
  contract for java.util.Map.&lt;br/&gt;
&lt;tt&gt;monospaced&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;But I don&apos;t want to hold release for discussion, so bumping this to approved backlog for further bikeshedding. &lt;img class=&quot;emoticon&quot; src=&quot;http://dev.clojure.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                    <comment id="26753" author="stu" created="Fri, 2 Sep 2011 09:39:50 -0500"  >&lt;p&gt;Better yet, let&apos;s just agreed on my prose and call this done.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                <customfield id="customfield_10002" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Approval</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10005">Accepted</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_10003" key="com.atlassian.jira.plugin.system.customfieldtypes:userpicker">
                <customfieldname>Waiting On</customfieldname>
                <customfieldvalues>
                    <customfieldvalue>stu</customfieldvalue>
                </customfieldvalues>
            </customfield>
                            </customfields>
    </item>
</channel>
</rss>