On Tuesday, May 28, 2019 at 1:45:35 AM UTC-4, Alexis King wrote: > > > On May 27, 2019, at 22:28, Jonathan Simpson <jjsi...@gmail.com > <javascript:>> wrote: > > > > 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. > > I might not be understanding your question properly, but I think the > answer is: yes, if your macro were to accept an identifier in the > `magic-name` position instead of a string, then you could put that > identifier in the expansion and it would “just work.” See this macro, for > example:[^1] > > #lang racket > (require (for-syntax syntax/parse)) > > (define-syntax (macro-that-defines-a-name stx) > (syntax-parse stx > [(_ some-name) > #'(define some-name 42)])) > > Hygiene ensures that `some-name` will be bound wherever the identifier > itself comes from, so it will be bound in whatever context uses > `macro-that-defines-a-name`: > > > (macro-that-defines-a-name my-name) > > my-name > 42 > > I will try this approach. Thinking about this has given me some insight that may explain my problem.
Both the function definition and function calls are created by similar looking macros which pass strings as the function name. I've now taken steps to break hygiene in the defining macro, but the calling macro just converts the string to a symbol. It's invocation looks something like this: (query (line (offset 0) (type "use") "tga-image")) Perhaps they aren't referring to the same binding. Maybe I need a datum->syntax in this macro as well. I don't have access to the code at the moment, so I can't try it, but does this make sense? If this is the case then I can probably fix it by modifying the other macro as well, but modifying the lexer to emit symbols instead of strings seems like the best approach. -- 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/e49d725a-3754-468a-b881-cd8b4dac1efe%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.