Your second macro does not work as you expect, because by default macros in 
racket are hygienic, described roughly that means that a macro only 
"manipulates" the syntax it is given as arguments, not with the syntax 
around its invocation. As gfb has mentioned one way to do this is to use 
parameters, this way you can achieve dynamic effects without breaking 
hygiene.

Why is hygiene good? This section in the guide explains: 
https://docs.racket-lang.org/guide/pattern-macros.html?q=macro#%28part._.Lexical_.Scope%29

You say you want to use some definitions in your macro, why not just pass 
the relevant ones as parameters? 
Without knowing more about what you are trying to do, it is difficult to 
suggest a good direction/solution.

Not part of the answer, but related and interesting:
(fifth RacketCon): Matthew Flatt — Bindings as Sets of Scopes
https://www.youtube.com/watch?v=ABWLveMNdzg

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/05e6ed93-596d-472e-8e3e-b2e7d87c695b%40googlegroups.com.

Reply via email to