Hi Cistian,
Both of your examples are hygienic, in the sense that neither actually
do anything that violates macro hygiene.
When `a_definition` is defined in the module context (i.e., the
"global namespace"), it has the same scope as the `a_definition` used
inside `my-macro`. (There's more to it, but this is enough for now.)
When `a_definition` is defined in a local context (e.g., inside a
`(let () ...)` form) outside `my-macro`, it won't have the same scope
as the `a_definition` used inside `my-macro`.
There's an easy trick to get around this. As Simon suggested, make
`a_definition` an argument to `my-macro`:
(define-simple-macro (my-macro a_definition)
(display a_definition))
Now, each call to `my-macro` "borrows" `a_definition` from the macro
caller's scope. There are other ways to tackle the problem, but this
is the safest option.
Eric
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/47407fc2-2c51-4cf1-a5b7-78a390484fbf%40googlegroups.com.