Thanks for the quick response. I wouldn't have gotten as far as I have so 
far without your 'Fear of Macros' page, so thanks for that as well!

On Monday, May 27, 2019 at 10:54:50 PM UTC-4, Greg Hendershott wrote:
>
> If users of your `named-query` macro will supply the name as an 
> identifier -- an unquoted symbol like some-name in this example: 
>
>   (named-query (name-line (_ 0) (_ "name") some-name)) 
>
> Then what your macro needs to do with the pattern variable is... just 
> use it -- as is -- in the template. (It is already a piece of syntax 
> that could be a valid identifier. You're all set.) 
>
>
>
This macro is part of the expansion of a language. There is a form that 
defines a function and another form to call one. I may be missing 
something, but I didn't think I could use the name as valid syntax since 
this is the form that is creating it. If passing a symbol in would work 
then I could potentially change my lexer to do that instead of a string.
 

> If the idea is that users will supply the name as a string like 
> "some-name", then yes your macro would need to do the 
>
>   (string->symbol (syntax->datum #'magic-name)) 
>
> thing you already have -- but *also* convert that result back to syntax: 
>
>   (datum->syntax #'magic-name 
>                  (string->symbol (syntax->datum #'magic-name))) 
>
>
I tried this in my with-syntax and for some reason the identifier was still 
not visible to the code that is calling it, which is in the same module. 
Any ideas? These macros are part of a language and aren't used directly 
from normal racket code. Perhaps there is some added complexity there?

-- Jonathan

-- 
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/fe82ed7d-d1f6-4e8a-a850-ca7e8a353ec0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to