The short answer is “no, but you can use -I to achieve a similar effect for some languages”.
The longer answer is as follows. The way the REPL is configured is different from the way modules’ readers are configured. The #lang protocol is relatively simple — you provide read and read-syntax — but the REPL is more complicated. There are a couple of different ways to configure the REPL, but they all involve adjusting a bunch of parameters, such as current-prompt-read and current-read-interaction. The easiest way to hook into these parameters is probably to expand to a configure-runtime submodule that sets them, but there are a number of different options[1]. However, while DrRacket will load the right runtime configuration from the current #lang, the command-line `racket` executable does not have any way to use the same behavior. The closest option is the -I flag, which sets the module that is loaded as an initialization step. This flag will load a configure-runtime submodule present in the specified library, but this is quite different from providing a #%module-begin that expands to something that produces a configure-runtime submodule. For that reason, to cooperate with -I, you effectively need your language’s module (i.e. the one without /lang/reader on the end) to be written in a language that includes the right configure-runtime in the expansion. For an example of this, you can see how main.rkt[2] uses a special language that configures the runtime[3] in my racket-tulip project. If you are not writing a language but are instead using one, there is some good news and some bad news. The good news is that you don’t really need to know all of the complex details of what I just described. The bad news is that if the -I flag doesn’t work, you’re mostly out of luck, though you can provide your own module with a configure-runtime submodule to create the necessary hook yourself. [1]: http://docs.racket-lang.org/reference/running-sa.html#%28part._configure-runtime%29 [2]: https://github.com/lexi-lambda/racket-tulip/blob/1613cfd4d7e8dbc8ceb86cf33479375147f42b2f/tulip-lib/main.rkt [3]: https://github.com/lexi-lambda/racket-tulip/blob/1613cfd4d7e8dbc8ceb86cf33479375147f42b2f/tulip-lib/private/configured-runtime-lang.rkt > On Oct 25, 2016, at 1:06 PM, Dan Liebgold <dan_liebg...@naughtydog.com> wrote: > > Is there a racket command line parameter that will enable me to start a REPL > (using -i) within a module context? Specifically I'd like the REPL to star > as if within a certain "#lang <mod>". > > Thanks, > Dan -- 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.