Uploaded image for project: 'ClojureScript'
  1. CLJS-359

`with-meta` does not work on function objects

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: None
    • Labels:
      None
    • Environment:

      CLJS Rhino-REPL and during Compilation

    • Patch:
      Code and Test

      Description

      `with-meta` does not working on function objects in CLJS. Compilation fails with the following error:

      Error: No protocol method IWithMeta.-with-meta defined for type function: function

      { return x; }

      I tried it out on the REPL and found the following:

      ---------- BEGIN: repl-rhino ----------
      ClojureScript:cljs.user> (with-meta #(do :foo) {:foo :bar})
      "Error evaluating:" (with-meta (fn* [] (do :foo)) {:foo :bar}) :as "cljs.core.with_meta.call(null,(function ()

      {\nreturn \"\\uFDD0'foo\";\n}

      ),cljs.core.ObjMap.fromObject([\"\\uFDD0'foo\"],

      {\"\\uFDD0'foo\":\"\\uFDD0'bar\"}

      ));\n"
      org.mozilla.javascript.JavaScriptException: Error: No protocol method IWithMeta.-with-meta defined for type function:
      function () {
      return "\ufdd0'foo";
      }
      (cljs/core.cljs#222)
      at cljs/core.cljs:222 (anonymous)
      at cljs/core.cljs:214 (_with_meta)
      at cljs/core.cljs:806 (with_meta)
      at <cljs repl>:2 (anonymous)
      at <cljs repl>:2

      nil
      ---------- END: repl-rhino ----------

      Reference: https://groups.google.com/forum/?fromgroups=#!topic/clojure/pRO-5IlilNM

        Attachments

          Activity

            People

            • Assignee:
              dnolen David Nolen
              Reporter:
              alex+import import
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: