> On Oct 1, 2017, at 12:50 PM, Jordan Johnson <j...@fellowhuman.com> wrote:
> 
> Correct me if I’m wrong in this understanding: the #'(module ...) is 
> effectively replacing the body of whatever program is written in #lang 
> mylang, so the path-string "semantics.rkt" must be interpreted relative to 
> that program’s source file.

Yes. See also [1]



> Anyway, the solution I found is to replace "semantics.rkt" with 
> mylang/semantics, but that seems like it might be brittle as well; is that 
> the right way, though? If not, how should I be specifying the connection to 
> the macros?

Yes, right way. Consider that your #lang can be used within a source file 
that's stored anywhere on the filesystem. Therefore, the reader and the 
expander both have to be specified in an absolute way (i.e., using a collection 
path). 

I agree, however, that having this path hard-coded into the guts of 
`read-syntax` feels fragile. Suppose you were to use a `collection` key in the 
"info.rkt" file to store the canonical collection name. [2] It seems like it 
should then be possible to have the syntax template in `read-syntax` derive the 
expander name from this key. (But I have not tried it.)


[1] https://beautifulracket.com/appendix/master-recipe.html#a_kOmmY 
<https://beautifulracket.com/appendix/master-recipe.html#a_kOmmY>

[2] https://beautifulracket.com/jsonic-3/the-info.rkt-file.html#a_KuYSc 
<https://beautifulracket.com/jsonic-3/the-info.rkt-file.html#a_KuYSc>


-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to