What's causing this 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 by syntax-quote in the output, so the result looks like
(defn some.namespace/htrhrthtrh [] (js/alert "hi"))
which is incorrect, as explained in the exception message.
Presumably you'll want to use ~name
in place of htrhrthtrh
to include the name argument to defn+
in the output; this, or anything along similar lines, would fix the problem. To hard-wire this exact name you'd have to say ~'htrhrthtrh
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With