beginners

2026-05-29T14:33:44.217479Z

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?

p-himik 2026-05-29T14:42:05.043189Z

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/Foo

👍 1
➕ 1
2026-05-29T18:51:01.204799Z

am I missing something?

(ins)user=> (defmacro m [sym] `'~sym)
#'user/m
(ins)user=> (m not-at-all-defined)
not-at-all-defined

2026-05-29T18:51:17.747969Z

that should work

2026-05-29T18:54:23.762569Z

it's not altering anything via reader, it's controlling evaluation

p-himik 2026-05-29T19:27:50.155949Z

Noah wants user/not-at-all-defined. Your code produces a simple symbol.

2026-05-29T20:56:05.400259Z

and what would "original ns" be?

p-himik 2026-05-29T21:08:03.479749Z

Where the macro was used, I presume - hence my impl.