<!-- 
RSS generated by JIRA (4.4#649-r158309) at Sat May 25 13:36:02 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-1171/CLJ-1171.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-1171] Compiler macro for clojure.core/instance? disregards lexical shadows on class names</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-1171</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;h1&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;Summary&lt;/h1&gt;
&lt;p&gt;The compiler tries to emit jvm native &lt;b&gt;instanceof&lt;/b&gt; expressions for direct &lt;b&gt;clojure.core/instance?&lt;/b&gt; calls.&lt;br/&gt;
For that, it tries to resolve its first argument as a class name. However, it disregards lexical bindings when doing that.&lt;br/&gt;
This is incongruent to the default implementation in core.clj&lt;/p&gt;

&lt;h2&gt;&lt;a name=&quot;Patches&quot;&gt;&lt;/a&gt;Patches&lt;/h2&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;Stu&amp;#93;&lt;/span&gt; All three patches should be applied IMO.&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;0002 makes &lt;tt&gt;instance?&lt;/tt&gt; respect lexical bindings&lt;/li&gt;
	&lt;li&gt;0003 makes &lt;tt&gt;instance?&lt;/tt&gt;&apos;s compiled form check arity, consistent with higher-order behavior&lt;/li&gt;
	&lt;li&gt;0001 has a minimal test for both 0002 and 0003.&lt;/li&gt;
&lt;/ul&gt;


&lt;h1&gt;&lt;a name=&quot;Data&quot;&gt;&lt;/a&gt;Data&lt;/h1&gt;

&lt;h2&gt;&lt;a name=&quot;Testcase&quot;&gt;&lt;/a&gt;Test case&lt;/h2&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;user=&amp;gt; (let [&lt;span class=&quot;code-object&quot;&gt;Long&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt;] (instance? &lt;span class=&quot;code-object&quot;&gt;Long&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;abc&quot;&lt;/span&gt;))
&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
;; expected &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; as in
user=&amp;gt; (let [&lt;span class=&quot;code-object&quot;&gt;Long&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt;] (apply instance? [&lt;span class=&quot;code-object&quot;&gt;Long&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;abc&quot;&lt;/span&gt;]))
&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;h2&gt;&lt;a name=&quot;Culpritmethod&quot;&gt;&lt;/a&gt;Culprit method&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/clojure/clojure/blob/4ccb10edbe66eae81336a4c0972050d9759b0bf7/src/jvm/clojure/lang/Compiler.java#L3578&quot;&gt;https://github.com/clojure/clojure/blob/4ccb10edbe66eae81336a4c0972050d9759b0bf7/src/jvm/clojure/lang/Compiler.java#L3578&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;&lt;a name=&quot;ListDiscussion&quot;&gt;&lt;/a&gt;List Discussion&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://groups.google.com/d/topic/clojure/mf25OlFRpa8/discussion&quot;&gt;https://groups.google.com/d/topic/clojure/mf25OlFRpa8/discussion&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;&lt;a name=&quot;Tangent&quot;&gt;&lt;/a&gt;Tangent&lt;/h1&gt;
&lt;p&gt;This was discovered because the same compiler macro also omits the arity check implicit in the default definition. This could also conveniently be fixed when touching that method:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;user=&amp;gt; (instance? &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt;)
&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
;; expected
user=&amp;gt; (apply instance? [&lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt;])
ArityException Wrong number of args (1) passed to: core$instance-QMARK-  clojure.lang.AFn.throwArity (AFn.java:437)&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;EDIT&lt;/b&gt; elaborated on ticket title and description; added tangent&lt;/p&gt;&lt;/blockquote&gt;</description>
                <environment></environment>
            <key id="16030">CLJ-1171</key>
            <summary>Compiler macro for clojure.core/instance? disregards lexical shadows on class names</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="1" iconUrl="http://dev.clojure.org/jira/images/icons/status_open.gif">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="stu">Stuart Halloway</assignee>
                                <reporter username="bendlas">Herwig Hochleitner</reporter>
                        <labels>
                    </labels>
                <created>Wed, 27 Feb 2013 13:21:16 -0600</created>
                <updated>Fri, 24 May 2013 11:29:14 -0500</updated>
                                                    <fixVersion>Release 1.6</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="30668" author="bendlas" created="Wed, 27 Feb 2013 20:11:30 -0600"  >&lt;p&gt;Attached patches test and fix issue + tangent&lt;/p&gt;</comment>
                    <comment id="30698" author="bendlas" created="Mon, 4 Mar 2013 15:51:36 -0600"  >&lt;p&gt;Note: Patch 0003 just adds the arity check, hence is optional, but if it&apos;s omitted from the patchset, the corresponding test from patch 0001 will fail.&lt;/p&gt;</comment>
                    <comment id="30843" author="stu" created="Fri, 29 Mar 2013 07:31:45 -0500"  >&lt;p&gt;Summarizing the decisions in these patches:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;tt&gt;instance?&lt;/tt&gt; and &lt;tt&gt;apply instance?&lt;/tt&gt; should be consistent&lt;/li&gt;
	&lt;li&gt;they should check arity  (matching &lt;tt&gt;apply instance?&lt;/tt&gt; existing behavior)&lt;/li&gt;
	&lt;li&gt;they should allow lexical shadowing of the class argument (matching &lt;tt&gt;apply instance?&lt;/tt&gt; existing behavior)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;It is possible (although unlikely) that existing code relies on the current eccentric behavior of &lt;tt&gt;instance?&lt;/tt&gt;.  I think it would be fair to categorize programs relying on this behavior as buggy, but that is easy for me to say. &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>
                </comments>
                    <attachments>
                    <attachment id="11877" name="0001-CLJ-1171-Tests-for-clojure.core-instance-compiler-ma.patch" size="919" author="bendlas" created="Wed, 27 Feb 2013 20:11:30 -0600" />
                    <attachment id="11878" name="0002-CLJ-1171-Obey-lexical-scope-for-class-argument-in-in.patch" size="1248" author="bendlas" created="Wed, 27 Feb 2013 20:11:30 -0600" />
                    <attachment id="11879" name="0003-CLJ-1171-Check-arity-in-instance-compiler-macro.patch" size="970" author="bendlas" created="Wed, 27 Feb 2013 20:11:30 -0600" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                <customfield id="customfield_10002" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Approval</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10004">Screened</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>