<!-- 
RSS generated by JIRA (4.4#649-r158309) at Thu May 23 08:32:03 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-1111/CLJ-1111.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-1111] Loops returning primtives are boxed even in return position</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-1111</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;Reported here: &lt;a href=&quot;https://groups.google.com/d/topic/clojure/atoFzbyuyos/discussion&quot;&gt;https://groups.google.com/d/topic/clojure/atoFzbyuyos/discussion&lt;/a&gt;&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;(defn first-bit?
  {:inline (fn [n] `(== 1 (clojure.lang.Numbers/and ~n, 1)) )}
  [^long n]
  (== 1 (clojure.lang.Numbers/and n, 1)))

(defn exp-int
  ^double [^double x, ^long c]
  (loop [result 1.0, factor x, c c]
    (if (&amp;gt; c 0)
        (recur
         (if (first-bit? c)
           (* result factor)
           result),
         (* factor factor),
         (bit-shift-right c 1))
      result)))
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Last lines of the Java bytecode of `exp-int`:&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;59 dload 5;               /* result */
61 invokestatic 40;       /* java.lang.Double java.lang.Double.valueOf(double c) */
64 checkcast 85;          /* java.lang.Number */
67 invokevirtual 89;      /* double doubleValue() */
70 dreturn;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The compiler doesn&apos;t currently infer the primitive type as soon as there is a recur:&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;(use &apos;[clojure.contrib.repl-utils :only [expression-info]])
(expression-info &apos;(loop [a 1] a))
;=&amp;gt; {:class long, :primitive? true}
(expression-info &apos;(loop [a 1] (if true a (recur a)))
;=&amp;gt; nil
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Patch attached.&lt;/p&gt;</description>
                <environment></environment>
            <key id="15841">CLJ-1111</key>
            <summary>Loops returning primtives are boxed even in return position</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="cgrand">Christophe Grand</assignee>
                                <reporter username="cgrand">Christophe Grand</reporter>
                        <labels>
                    </labels>
                <created>Wed, 21 Nov 2012 05:17:11 -0600</created>
                <updated>Sat, 22 Dec 2012 09:53:50 -0600</updated>
                    <resolved>Sat, 22 Dec 2012 09:53:50 -0600</resolved>
                            <version>Release 1.4</version>
                                <fixVersion>Release 1.5</fixVersion>
                                        <due></due>
                    <votes>3</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="30033" author="stu" created="Sun, 25 Nov 2012 19:12:19 -0600"  >&lt;p&gt;Tests pass, code looks reasonable. Would appreciate additional review.&lt;/p&gt;</comment>
                    <comment id="30036" author="halgari" created="Mon, 26 Nov 2012 10:59:59 -0600"  >&lt;p&gt;Tests also pass here. Looked through the code and played with a patched version of Clojure. I can&apos;t see a problem with it. &lt;/p&gt;</comment>
                    <comment id="30046" author="cgrand" created="Tue, 27 Nov 2012 04:40:05 -0600"  >&lt;p&gt;FYI, gvec.clj has two loops which return primitives and thus was formerly boxed.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11693" name="prim-loop.diff" size="3083" author="cgrand" created="Wed, 21 Nov 2012 05:17:11 -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="10001">Code</customfieldvalue>

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