clojure - ClojureScript macro error: "Can't def ns-qualified name" -
what's causing error?
(defmacro defn+ [name & stmts] `(defn htrhrthtrh ~@stmts)) (defn+ init [] (js/alert "hi"))
--
java.lang.assertionerror: assert failed: can't def ns-qualified name (not (namespace sym))
htrhrthtrh
gets namespace-qualified syntax-quote in output, result looks like
(defn some.namespace/htrhrthtrh [] (js/alert "hi"))
which incorrect, explained in exception message.
presumably you'll want use ~name
in place of htrhrthtrh
include name argument defn+
in output; this, or along similar lines, fix problem. hard-wire exact name you'd have ~'htrhrthtrh
.
Comments
Post a Comment