-
The code (prn #js [1 2]) correctly compiles to cherry_core.prn.call(null, [1, 2]); But now let's say that I want to refactor said code with a macro, by doing ;; file macros.cljs
(ns macros)
(defmacro append-two-then-as-js [x]
(quote #js [~x 2])
;; file main.js
(ns main
(:require-macros
[macros :refer [append-two-then-as-js]]))
(prn (append-two-then-as-js 1)) The resulting code is cherry_core.prn.call(null, [object Object]); Problem: Question: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
You can't do that. Just don't use
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@ranfdev In the latest cherry version the key changed to |
Beta Was this translation helpful? Give feedback.
Actually after digging in some more, if you would return from the macro:
on the returned map, I think cherry might already translate it to a JS object at compile time.