I have a macro that takes a symbol and inserts it into the syntax-quoted code. in an error branch, i'd like to convert it to a fully-quoted symbol: (my-assert Foo) -> (... (throw (ex-info "bad" {:obj 'original-ns/Foo})))` what's the way to write the syntax quotes/unquotes such that i can get this?
I'd construct it programmatically. Quotes affect reading. When you pass a symbol to a macro, it has already been read - you cannot alter it via the reader.
user=> (defmacro m [sym] (symbol (name (ns-name *ns*)) (name sym)))
#'user/m
user=> (m Foo)
Syntax error compiling at (REPL:1:1).
No such var: user/Fooam I missing something?
(ins)user=> (defmacro m [sym] `'~sym)
#'user/m
(ins)user=> (m not-at-all-defined)
not-at-all-definedthat should work
it's not altering anything via reader, it's controlling evaluation
Noah wants user/not-at-all-defined. Your code produces a simple symbol.
and what would "original ns" be?
Where the macro was used, I presume - hence my impl.