<!-- 
RSS generated by JIRA (4.4#649-r158309) at Tue Jun 18 19:14:17 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/CLJS-359/CLJS-359.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>[CLJS-359] `with-meta` does not work on function objects</title>
                <link>http://dev.clojure.org/jira/browse/CLJS-359</link>
                <project id="10040" key="CLJS">ClojureScript</project>
                        <description>&lt;p&gt;`with-meta` does not working on function objects in CLJS. Compilation fails with the following error:&lt;/p&gt;

&lt;p&gt;Error: No protocol method IWithMeta.-with-meta defined for type function: function &lt;img class=&quot;emoticon&quot; src=&quot;http://dev.clojure.org/jira/images/icons/emoticons/error.gif&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; {
      return x;
    }&lt;/p&gt;

&lt;p&gt;I tried it out on the REPL and found the following:&lt;/p&gt;

&lt;p&gt;---------- BEGIN: repl-rhino ----------&lt;br/&gt;
ClojureScript:cljs.user&amp;gt; (with-meta #(do :foo) {:foo :bar})&lt;br/&gt;
&quot;Error evaluating:&quot; (with-meta (fn* [] (do :foo)) {:foo :bar}) :as &quot;cljs.core.with_meta.call(null,(function (){\nreturn \&quot;\\uFDD0&apos;foo\&quot;;\n}),cljs.core.ObjMap.fromObject(&lt;span class=&quot;error&quot;&gt;&amp;#91;\&amp;quot;\\uFDD0&amp;#39;foo\&amp;quot;&amp;#93;&lt;/span&gt;,{\&quot;\\uFDD0&apos;foo\&quot;:\&quot;\\uFDD0&apos;bar\&quot;}));\n&quot;&lt;br/&gt;
org.mozilla.javascript.JavaScriptException: Error: No protocol method IWithMeta.-with-meta defined for type function: &lt;br/&gt;
function () {
    return &quot;\ufdd0&apos;foo&quot;;
}&lt;br/&gt;
 (cljs/core.cljs#222)&lt;br/&gt;
	at cljs/core.cljs:222 (anonymous)&lt;br/&gt;
	at cljs/core.cljs:214 (_with_meta)&lt;br/&gt;
	at cljs/core.cljs:806 (with_meta)&lt;br/&gt;
	at &amp;lt;cljs repl&amp;gt;:2 (anonymous)&lt;br/&gt;
	at &amp;lt;cljs repl&amp;gt;:2&lt;/p&gt;

&lt;p&gt;nil&lt;br/&gt;
---------- END: repl-rhino ----------&lt;/p&gt;

&lt;p&gt;Reference: &lt;a href=&quot;https://groups.google.com/forum/?fromgroups=#!topic/clojure/pRO-5IlilNM&quot;&gt;https://groups.google.com/forum/?fromgroups=#!topic/clojure/pRO-5IlilNM&lt;/a&gt;&lt;/p&gt;</description>
                <environment>CLJS Rhino-REPL and during Compilation</environment>
            <key id="15644">CLJS-359</key>
            <summary>`with-meta` does not work on function objects</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="5" iconUrl="http://dev.clojure.org/jira/images/icons/status_resolved.gif">Resolved</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="dnolen">David Nolen</assignee>
                                <reporter username="kumarshantanu">Shantanu Kumar</reporter>
                        <labels>
                        <label>bug</label>
                    </labels>
                <created>Sat, 25 Aug 2012 16:39:55 -0500</created>
                <updated>Wed, 21 Nov 2012 16:21:13 -0600</updated>
                    <resolved>Wed, 21 Nov 2012 16:21:13 -0600</resolved>
                                                                    <due></due>
                    <votes>1</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="29285" author="dnolen" created="Wed, 29 Aug 2012 09:52:35 -0500"  >&lt;p&gt;We could create a fn wrapper type of some kind that implements all the supported arities of IFn (this means the compiler needs to guarantee that args past 20 are collected into an array-seq) that include the extra meta fields. Seems doable.&lt;/p&gt;</comment>
                    <comment id="29554" author="ohpauleez" created="Fri, 28 Sep 2012 15:21:14 -0500"  >&lt;p&gt;I have created that exact function wrapper - it&apos;s in Shoreleave.  We can move it into CLJS proper if you like.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/shoreleave/shoreleave-core/blob/master/src/shoreleave/efunction.cljs&quot;&gt;https://github.com/shoreleave/shoreleave-core/blob/master/src/shoreleave/efunction.cljs&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="29555" author="dnolen" created="Fri, 28 Sep 2012 15:24:55 -0500"  >&lt;p&gt;That&apos;s nice but would prefer to have as little overhead as possible.&lt;/p&gt;</comment>
                    <comment id="29556" author="ohpauleez" created="Fri, 28 Sep 2012 15:27:30 -0500"  >&lt;p&gt;ala unrolling the invoke call?&lt;/p&gt;

&lt;p&gt;More than happy to start pulling together a patch.&lt;/p&gt;</comment>
                    <comment id="29557" author="dnolen" created="Fri, 28 Sep 2012 15:34:33 -0500"  >&lt;p&gt;Yes there&apos;s actually an existing ticket for that. Thanks. We also need compiler support for function invocations when there&apos;s more then 20 arguments - though that&apos;s a different existing ticket.&lt;/p&gt;</comment>
                    <comment id="29749" author="ohpauleez" created="Mon, 22 Oct 2012 07:50:55 -0500"  >&lt;p&gt;I was just waiting on &lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJS-365&quot; title=&quot;apply needs to put all args after the 20th into an array seq&quot;&gt;CLJS-365&lt;/a&gt; to be completed.  Did you think of a better approach than the deftype-wrapper?  More than happy to push on this.&lt;/p&gt;</comment>
                    <comment id="29780" author="dnolen" created="Tue, 23 Oct 2012 18:36:25 -0500"  >&lt;p&gt;I thought about this some more - this patch is really about adding metadata to functions at runtime - static metadata on defs are stored in cljs.analyzer/namespaces. Given that it&apos;s runtime I think your simple patch is actually OK, we can&apos;t generally optimize functions like that anyway since we won&apos;t have that kind of information available.&lt;/p&gt;</comment>
                    <comment id="30003" author="bbloom" created="Wed, 21 Nov 2012 15:29:45 -0600"  >&lt;p&gt;Patch adds a Function type and extends js/function to support metadata. There is now an Fn marker protocol.&lt;/p&gt;

&lt;p&gt;Patch also includes an additional commit to fix the behavior of the this variable for IFn definitions.&lt;/p&gt;

&lt;p&gt;Not tested on JavaScriptCore.&lt;/p&gt;</comment>
                    <comment id="30004" author="bbloom" created="Wed, 21 Nov 2012 16:16:33 -0600"  >&lt;p&gt;v2 of patch improves speed of fn? and utilizes reify to avoid creating an explicit Function type&lt;/p&gt;</comment>
                    <comment id="30005" author="dnolen" created="Wed, 21 Nov 2012 16:21:13 -0600"  >&lt;p&gt;fixed, &lt;a href=&quot;http://github.com/clojure/clojurescript/commit/6ce3b1cef3824fd36e75402f5a8ed5053252b15e&quot;&gt;http://github.com/clojure/clojurescript/commit/6ce3b1cef3824fd36e75402f5a8ed5053252b15e&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11695" name="CLJS-359-v1.patch" size="3984" author="bbloom" created="Wed, 21 Nov 2012 15:29:45 -0600" />
                    <attachment id="11696" name="CLJS-359-v2.patch" size="3908" author="bbloom" created="Wed, 21 Nov 2012 16:16:33 -0600" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                                            <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>