I'm trying to create an atom in a macro function and embed a reference to it in the macro output form:
(defmacro x []
(let [a (atom {})]
`(fn []
~a)))
an attempt to use this macro results in this error:
`
(x)
Syntax error compiling fn* at (/tmp/form-init15982565344292085756.clj:1:1).
Can't embed object in code, maybe print-dup not defined: clojure.lang.Atom@350e9f50
`
I tried defining an empty print-dup
overload but it resulted in a different error:
`
(defmethod print-dup clojure.lang.Atom [x w])
(x)
Syntax error compiling fn* at (/tmp/form-init15982565344292085756.clj:1:1).
Can't embed unreadable object in code: clojure.lang.Atom@5f3623b3
`
I would expect this to work since clojure has eval. What is the issue here?