New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
syntax/module-reader
is brittle
#2368
Comments
Right, because when you invoke a ;; /path/to/test/b.rkt
#lang reader "../raquet.rkt"
(define identity (function (x) x))
(print (identity 5)) You end up with the equivalent module expression, which looks like this: ;; /path/to/test/b.rkt
(module b "raquet-mlang.rkt"
(define identity (function (x) x))
(print (identity 5))) Naturally, In general, this is why you want to use an (absolute) module path for your expander — it works no matter where the source file is on your filesystem. AFAICT the toy example is written this way to save the step of installing the expander module as a package. (Perhaps it shouldn’t be, if it’s unwittingly introducing a bad habit.) |
I think we could use |
Although I understand now why it works like that, it still feels really weird as a user, especially since the reader can be required using relative path without any problem. For anyone who stumbles upon this issue, @samth's suggestion can indeed be used as a workaround. Note that you should use
Is it a good idea to mention |
I think improving the example to use define-runtime-path is a good idea. |
Depending on where the running file is, Racket might or might not find a module.
For example, consider the example from https://docs.racket-lang.org/guide/syntax_module-reader.html:
This runs without any problem.
Now, create a new file:
Running it, we get this error:
The text was updated successfully, but these errors were encountered: