Old question that was never answered: At Fri, 10 Nov 2017 21:34:24 -0500, Alex Knauth wrote: > How does a macro properly expand to a define-runtime-path? > > The documentation for define-runtime-path says this: > > If the form has a source module according to syntax-source-module > <file:///Applications/Racket/2017-10-29/Racket%20v6.11.0.2/doc/reference/stxops > .html#%28def._%28%28quote._~23~25kernel%29._syntax-source-module%29%29>> > This tells me that if I want to specify the path it uses to anchor relative > paths, I should give the define-runtime-path form a source location from the > file I want it to use. > > (define-syntax-parser macro > [(_ name path-expr) > (quasisyntax/loc #'name > (define-runtime-path name path-expr))])
The confusing part is that `syntax-source-module` is based on a syntax object's scopes, not its source location. [Back when `define-runtime-path` was defined, it seemed like that might be a good idea. It wasn't, and we later figured out that building on `(#%variable-reference)` is a better idea.] So, I think the macro you wanted was (define-syntax (macro stx) (syntax-parse stx [(_ name path-expr) (datum->syntax stx (syntax-e #'(define-runtime-path name path-expr)) stx)])) I'll update the documentation for `syntax-source-module` and `define-runtime-path` to clarify. -- 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/5cf6e3fe.1c69fb81.1d006.0c87SMTPIN_ADDED_MISSING%40gmr-mx.google.com. For more options, visit https://groups.google.com/d/optout.