<!-- 
RSS generated by JIRA (4.4#649-r158309) at Fri May 24 03:10:26 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-837/CLJ-837.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-837] java.lang.VerifyError when compiling deftype or defrecord with argument name starting with double underscore characters.</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-837</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;The minimal test to trigger the verification error is :&lt;/p&gt;

&lt;p&gt;(deftype t &lt;span class=&quot;error&quot;&gt;&amp;#91;__&amp;#93;&lt;/span&gt;) &lt;br/&gt;
or&lt;br/&gt;
(defrecord r &lt;span class=&quot;error&quot;&gt;&amp;#91;__&amp;#93;&lt;/span&gt;)&lt;/p&gt;

&lt;p&gt;It works fine in clojure 1.2, 1.2.1&lt;/p&gt;

&lt;p&gt;Works fine with one underscore.&lt;/p&gt;

&lt;p&gt;Output from REPL:&lt;/p&gt;

&lt;p&gt;user=&amp;gt; (defrecord r &lt;span class=&quot;error&quot;&gt;&amp;#91;__&amp;#93;&lt;/span&gt;)&lt;br/&gt;
CompilerException java.lang.VerifyError: (class: user/r, method: create signature: (Lclojure/lang/IPersistentMap;)Luser/r&lt;img class=&quot;emoticon&quot; src=&quot;http://dev.clojure.org/jira/images/icons/emoticons/wink.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; Expecting to find object/array on stack, compiling:(NO_SOURCE_PATH:2) &lt;/p&gt;

&lt;p&gt;Stack trace from slime session:&lt;/p&gt;

&lt;p&gt;(class: clojure/data/priority_map/r, method: create signature: (Lclojure/lang/IPersistentMap;)Lclojure/data/priority_map/r&lt;img class=&quot;emoticon&quot; src=&quot;http://dev.clojure.org/jira/images/icons/emoticons/wink.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; Expecting to find object/array on stack&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;Thrown class java.lang.VerifyError&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Restarts:&lt;br/&gt;
 0: &lt;span class=&quot;error&quot;&gt;&amp;#91;QUIT&amp;#93;&lt;/span&gt; Quit to the SLIME top level&lt;/p&gt;

&lt;p&gt;Backtrace:&lt;br/&gt;
  0: java.lang.Class.forName0(Native Method)&lt;br/&gt;
  1: java.lang.Class.forName(Class.java:247)&lt;br/&gt;
  2: clojure.lang.RT.classForName(RT.java:2013)&lt;br/&gt;
  3: clojure.lang.Compiler$HostExpr.maybeClass(Compiler.java:929)&lt;br/&gt;
  4: clojure.lang.Compiler$HostExpr.access$400(Compiler.java:710)&lt;br/&gt;
  5: clojure.lang.Compiler$NewExpr$Parser.parse(Compiler.java:2391)&lt;br/&gt;
  6: clojure.lang.Compiler.analyzeSeq(Compiler.java:6368)&lt;br/&gt;
  7: clojure.lang.Compiler.analyze(Compiler.java:6175)&lt;br/&gt;
  8: clojure.lang.Compiler.analyze(Compiler.java:6136)&lt;br/&gt;
  9: clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5531)&lt;br/&gt;
 10: clojure.lang.Compiler$FnMethod.parse(Compiler.java:4967)&lt;br/&gt;
      &lt;span class=&quot;error&quot;&gt;&amp;#91;No Locals&amp;#93;&lt;/span&gt;&lt;br/&gt;
 11: clojure.lang.Compiler$FnExpr.parse(Compiler.java:3588)&lt;br/&gt;
 12: clojure.lang.Compiler.analyzeSeq(Compiler.java:6366)&lt;br/&gt;
 13: clojure.lang.Compiler.analyze(Compiler.java:6175)&lt;br/&gt;
 14: clojure.lang.Compiler.analyzeSeq(Compiler.java:6356)&lt;br/&gt;
 15: clojure.lang.Compiler.analyze(Compiler.java:6175)&lt;br/&gt;
 16: clojure.lang.Compiler.access$100(Compiler.java:37)&lt;br/&gt;
 17: clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:492)&lt;br/&gt;
 18: clojure.lang.Compiler.analyzeSeq(Compiler.java:6368)&lt;br/&gt;
 19: clojure.lang.Compiler.analyze(Compiler.java:6175)&lt;br/&gt;
 20: clojure.lang.Compiler.analyzeSeq(Compiler.java:6356)&lt;br/&gt;
 21: clojure.lang.Compiler.analyze(Compiler.java:6175)&lt;br/&gt;
 22: clojure.lang.Compiler.analyze(Compiler.java:6136)&lt;br/&gt;
 23: clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5531)&lt;br/&gt;
 24: clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5832)&lt;br/&gt;
 25: clojure.lang.Compiler.analyzeSeq(Compiler.java:6368)&lt;br/&gt;
 26: clojure.lang.Compiler.analyze(Compiler.java:6175)&lt;br/&gt;
 27: clojure.lang.Compiler.analyze(Compiler.java:6136)&lt;br/&gt;
 28: clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5531)&lt;br/&gt;
 29: clojure.lang.Compiler$FnMethod.parse(Compiler.java:4967)&lt;br/&gt;
 30: clojure.lang.Compiler$FnExpr.parse(Compiler.java:3588)&lt;br/&gt;
 31: clojure.lang.Compiler.analyzeSeq(Compiler.java:6366)&lt;br/&gt;
 32: clojure.lang.Compiler.analyze(Compiler.java:6175)&lt;br/&gt;
 33: clojure.lang.Compiler.eval(Compiler.java:6421)&lt;br/&gt;
 34: clojure.lang.Compiler.eval(Compiler.java:6390)&lt;br/&gt;
 35: clojure.core$eval.invoke(core.clj:2795)&lt;br/&gt;
 36: swank.commands.basic$eval_region.invoke(basic.clj:47)&lt;br/&gt;
 37: swank.commands.basic$eval_region.invoke(basic.clj:37)&lt;br/&gt;
 38: swank.commands.basic$eval764$listener_eval__765.invoke(basic.clj:71)&lt;br/&gt;
 39: clojure.lang.Var.invoke(Var.java:401)&lt;br/&gt;
 40: clojure.data.priority_map$eval2759.invoke(NO_SOURCE_FILE)&lt;br/&gt;
 41: clojure.lang.Compiler.eval(Compiler.java:6424)&lt;br/&gt;
 42: clojure.lang.Compiler.eval(Compiler.java:6390)&lt;br/&gt;
 43: clojure.core$eval.invoke(core.clj:2795)&lt;br/&gt;
 44: swank.core$eval_in_emacs_package.invoke(core.clj:92)&lt;br/&gt;
 45: swank.core$eval_for_emacs.invoke(core.clj:239)&lt;br/&gt;
 46: clojure.lang.Var.invoke(Var.java:409)&lt;br/&gt;
 47: clojure.lang.AFn.applyToHelper(AFn.java:167)&lt;br/&gt;
 48: clojure.lang.Var.applyTo(Var.java:518)&lt;br/&gt;
 49: clojure.core$apply.invoke(core.clj:600)&lt;br/&gt;
 50: swank.core$eval_from_control.invoke(core.clj:99)&lt;br/&gt;
      &lt;span class=&quot;error&quot;&gt;&amp;#91;No Locals&amp;#93;&lt;/span&gt;&lt;br/&gt;
 51: swank.core$eval_loop.invoke(core.clj:104)&lt;br/&gt;
 52: swank.core$spawn_repl_thread$fn_&lt;em&gt;529$fn&lt;/em&gt;_530.invoke(core.clj:309)&lt;br/&gt;
 53: clojure.lang.AFn.applyToHelper(AFn.java:159)&lt;br/&gt;
 54: clojure.lang.AFn.applyTo(AFn.java:151)&lt;br/&gt;
 55: clojure.core$apply.invoke(core.clj:600)&lt;br/&gt;
 56: swank.core$spawn_repl_thread$fn__529.doInvoke(core.clj:306)&lt;br/&gt;
 57: clojure.lang.RestFn.invoke(RestFn.java:397)&lt;br/&gt;
 58: clojure.lang.AFn.run(AFn.java:24)&lt;br/&gt;
 59: java.lang.Thread.run(Thread.java:680)&lt;/p&gt;
</description>
                <environment>clojure-1.3.0-beta3 and git master, JDK 1.6.0_26, OS X 1.7.1</environment>
            <key id="14622">CLJ-837</key>
            <summary>java.lang.VerifyError when compiling deftype or defrecord with argument name starting with double underscore characters.</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</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="fogus">Fogus</assignee>
                                <reporter username="troussan">Tchavdar Roussanov</reporter>
                        <labels>
                    </labels>
                <created>Sun, 11 Sep 2011 19:05:10 -0500</created>
                <updated>Fri, 9 Dec 2011 10:01:00 -0600</updated>
                    <resolved>Fri, 9 Dec 2011 10:01:00 -0600</resolved>
                            <version>Release 1.3</version>
                                <fixVersion>Release 1.4</fixVersion>
                                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="26785" author="fogus" created="Sun, 11 Sep 2011 21:18:14 -0500"  >&lt;p&gt;The privileged names __meta and __extmap are implementation details of  types and records and should probably not be viewed as real.  In other  words, since they are not published as part of the type/record docs,  then they may not exist in the future.  Having said that, the current Clojure implementation treats any name starting with __ as a special  field and doesn&apos;t count them toward the field count.  As a result,  when emitting the MyType.create method (another implementation  detail), the fields marked as __ throw off the field count and as a result the bytecode is not emitted properly.  I know how to change the  code to allow names prefixed with __ and fixing the validation error (not called by those two special names listed above), but I hesitate to say that is the solution &lt;br/&gt;
without further reflection.&lt;/p&gt;</comment>
                    <comment id="26788" author="fogus" created="Mon, 12 Sep 2011 08:32:16 -0500"  >&lt;p&gt;I think the prudent fix is as follows:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Allow any legal name &lt;b&gt;except&lt;/b&gt; those in the set #{__meta __extmap}&lt;/li&gt;
	&lt;li&gt;Fix the #create emission&lt;/li&gt;
	&lt;li&gt;Documentation should be changed to reflect that the aforementioned set is disallowed&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Thankfully this is an easy fix.  However, the &quot;magic&quot; of __ prefixed names will go away.  That is, the following behavior will differ from v1.2:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;(defrecord R [__a ___b])
(:__a (R. 42 9))
;=&amp;gt; 42

(deftype T [__a])
(.__a (T. 36))
;=&amp;gt; 36

(deftype T2 [a b __meta])
;; AssertionError
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Any thoughts?&lt;/p&gt;</comment>
                    <comment id="26789" author="fogus" created="Mon, 12 Sep 2011 09:44:09 -0500"  >&lt;p&gt;If anyone is interested, the changes reflected in the previous comment can be found on my own branch: &lt;a href=&quot;https://github.com/fogus/clojure/tree/CLJ-837&quot;&gt;https://github.com/fogus/clojure/tree/CLJ-837&lt;/a&gt;  Code-review would be nice.&lt;/p&gt;</comment>
                    <comment id="26790" author="richhickey" created="Mon, 12 Sep 2011 10:09:23 -0500"  >&lt;p&gt;differing behavior of undocumented features is a non-problem&lt;/p&gt;</comment>
                    <comment id="26791" author="fogus" created="Mon, 12 Sep 2011 12:05:52 -0500"  >&lt;p&gt;Got it.  Thanks Rich.&lt;/p&gt;</comment>
                    <comment id="26792" author="fogus" created="Mon, 12 Sep 2011 12:25:11 -0500"  >&lt;p&gt;Added patch file.&lt;/p&gt;</comment>
                    <comment id="26793" author="steveminer@gmail.com" created="Mon, 12 Sep 2011 14:11:41 -0500"  >&lt;p&gt;I suggest that the documentation should simply say that all fields beginning with double-underscore (__) are reserved.  You don&apos;t have to enforce that (as the patch allows any field name except __meta and __extmap), but it&apos;s better to be conservative with the documentation so that you have some room to innovate.&lt;/p&gt;</comment>
                    <comment id="26794" author="steveminer@gmail.com" created="Mon, 12 Sep 2011 14:13:57 -0500"  >&lt;p&gt;Just by inspection, it looks like patch has an extra space before the &apos;b&apos; in the line near the end:&lt;/p&gt;

&lt;p&gt;+           2 (:___ b r)&lt;/p&gt;</comment>
                    <comment id="27405" author="stu" created="Fri, 2 Dec 2011 13:53:02 -0600"  >&lt;p&gt;0837-fixed is same as original patch, but with fixed unit test.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10730" name="0837-fixed.patch" size="5202" author="stu" created="Fri, 2 Dec 2011 13:53:02 -0600" />
                    <attachment id="10346" name="CLJ-837-double-underscore-type-records.diff" size="4278" author="fogus" created="Mon, 12 Sep 2011 12:33:47 -0500" />
                </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>
                                                                                    <customfield id="customfield_10003" key="com.atlassian.jira.plugin.system.customfieldtypes:userpicker">
                <customfieldname>Waiting On</customfieldname>
                <customfieldvalues>
                    <customfieldvalue>richhickey</customfieldvalue>
                </customfieldvalues>
            </customfield>
                            </customfields>
    </item>
</channel>
</rss>