Re: [racket-users] how to wrap a #lang module for the REPL?
Yes, you are right, runtime-config will do the job. Runtime-config does need a module wrapper around the main #lang module (as the example in the docs [1] suggests) but this is no longer bothersome now that the issue with macro-introduced imports within the main #lang module is solved. [1] http://docs.racket-lang.org/guide/module-runtime-config.html On Aug 15, 2015, at 9:47 PM, Alexander D. Knauth wrote: > > > I think a better way of doing that would be using a runtime-config module as > in: > http://docs.racket-lang.org/guide/module-runtime-config.html > Or I think you can also do that with a #%configure-runtime sudmodule (or > something like that)? > >> On Aug 15, 2015, at 5:08 PM, Matthew Butterick wrote: >> >>> Probably the wiser option. I'll see if I can adapt that solution. >>> >>> >>> On Aug 15, 2015, at 4:31 PM, Alexander D. Knauth >>> wrote: >>> What kind of funny stuff? By the way, this sounds sort of like this http://www.mail-archive.com/racket-users@googlegroups.com/msg28020.html Solution: http://www.mail-archive.com/racket-users@googlegroups.com/msg28031.html Although it could be a completely different problem, I don't know. On Aug 15, 2015, at 6:22 PM, Matthew Butterick wrote: > I have a #lang that does some funny stuff with #%module-begin (maybe too > funny), the result being that when I run it in DrRacket, the `provide`d > identifiers aren't visible at the top level: > > (module my-lang-module my-lang > ... > (define id 42) > (provide id)) > >> id > id : undefined; > cannot reference undefined identifier > > > I've found a simple cure (maybe too simple) whereby I wrap my-lang-module > with the usual racket/base module, which satisfies DrRacket: > > > (module repl-wrapper racket/base > (module my-lang-module my-lang > ... > (define id 42) > (provide id)) > (require 'my-lang-module) > (provide (all-from-out 'my-lang-module)) > >> id > 42 > > > Question: is there an approved way to make this #lang-wrapping happen for > the REPL, and only for the REPL? AFAICT `#%top-interaction` is not the > cure, because it wraps the commands coming off the REPL (as opposed to > the code in the definitions window). > > -- > 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. >>> >> > -- 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.
Re: [racket-users] how to wrap a #lang module for the REPL?
Thanks for the clue. I found the problem. The double-quoted sub is right, but the name of the submodule itself has to be `sub`, not `sub-id`. (define-syntax my-module-begin (lambda (stx) (syntax-case stx () [(_ body ...) (with-syntax ([sub-id (datum->syntax stx ''sub)]) #'(#%module-begin (module sub racket/base ;; !! name of module is sub, not sub-id (define x 2) (provide x)) (require sub-id) (provide (all-from-out sub-id)) body ...))]))) On Aug 15, 2015, at 10:14 PM, Alexander D. Knauth wrote: > Based on this experiment, the double-quoted sub should be the right thing, > and the single-quoted inside the datum->syntax with another quote in the > require and provide forms shouldn't work. > > Just like this works: > #lang racket > (require syntax/parse/define) > (define-simple-macro (m x) > #:with req-spec (datum->syntax #'x ''sub) > (begin > (module sub racket/base > (provide y) > (define y 3)) > (require req-spec))) > (m x) > y > > But this doesn't: > #lang racket > (require syntax/parse/define) > (define-simple-macro (m x) > #:with req-spec (datum->syntax #'x 'sub) > (begin > (module sub racket/base > (provide y) > (define y 3)) > (require 'req-spec))) > (m x) > y > > On Aug 16, 2015, at 12:09 AM, Matthew Butterick wrote: > >> No, the double-quoted ''sub doesn't work (triggers bad-syntax error). >> >> Nor does this (with quotes added to `sub-id` within the `require` and >> `provide` forms): >> >> (define-syntax my-module-begin >> (lambda (stx) >> (syntax-case stx () >> [(_ body ...) >>(with-syntax ([sub-id (datum->syntax stx 'sub)]) >> #'(#%module-begin >> (module sub-id racket/base >> (define x 2) >> (provide x)) >> (require 'sub-id) >> (provide (all-from-out 'sub-id)) >> body ...))]))) >> >> On Sat, Aug 15, 2015 at 9:56 PM, Alexander D. Knauth >> wrote: >> >> On Aug 15, 2015, at 11:53 PM, Alexander D. Knauth >> wrote: >> >> > Does this work? >> > (define-syntax my-module-begin >> > (lambda (stx) >> >(syntax-case stx () >> > [(_ body ...) >> > (with-syntax ([sub-id (datum->syntax stx ''sub)]) >> > #'(#%module-begin >> > (module sub-id racket/base >> > (define x 2) >> > (provide x)) >> > (require sub-id) >> > (provide (all-from-out sub-id)) >> > body ...))]))) >> >> I just realized that's not your example, so anyway, does modifying your >> example to use (datum->syntax stx ''sub) instead of (datum->syntax stx 'sub) >> work? >> >> > > > -- > 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. -- 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.
Re: [racket-users] how to wrap a #lang module for the REPL?
Based on this experiment, the double-quoted sub should be the right thing, and the single-quoted inside the datum->syntax with another quote in the require and provide forms shouldn't work. Just like this works: #lang racket (require syntax/parse/define) (define-simple-macro (m x) #:with req-spec (datum->syntax #'x ''sub) (begin (module sub racket/base (provide y) (define y 3)) (require req-spec))) (m x) y But this doesn't: #lang racket (require syntax/parse/define) (define-simple-macro (m x) #:with req-spec (datum->syntax #'x 'sub) (begin (module sub racket/base (provide y) (define y 3)) (require 'req-spec))) (m x) y On Aug 16, 2015, at 12:09 AM, Matthew Butterick wrote: > No, the double-quoted ''sub doesn't work (triggers bad-syntax error). > > Nor does this (with quotes added to `sub-id` within the `require` and > `provide` forms): > > (define-syntax my-module-begin > (lambda (stx) > (syntax-case stx () > [(_ body ...) >(with-syntax ([sub-id (datum->syntax stx 'sub)]) > #'(#%module-begin > (module sub-id racket/base > (define x 2) > (provide x)) > (require 'sub-id) > (provide (all-from-out 'sub-id)) > body ...))]))) > > On Sat, Aug 15, 2015 at 9:56 PM, Alexander D. Knauth > wrote: > > On Aug 15, 2015, at 11:53 PM, Alexander D. Knauth > wrote: > > > Does this work? > > (define-syntax my-module-begin > > (lambda (stx) > >(syntax-case stx () > > [(_ body ...) > > (with-syntax ([sub-id (datum->syntax stx ''sub)]) > > #'(#%module-begin > > (module sub-id racket/base > > (define x 2) > > (provide x)) > > (require sub-id) > > (provide (all-from-out sub-id)) > > body ...))]))) > > I just realized that's not your example, so anyway, does modifying your > example to use (datum->syntax stx ''sub) instead of (datum->syntax stx 'sub) > work? > > -- 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.
Re: [racket-users] how to wrap a #lang module for the REPL?
No, the double-quoted ''sub doesn't work (triggers bad-syntax error). Nor does this (with quotes added to `sub-id` within the `require` and `provide` forms): (define-syntax my-module-begin (lambda (stx) (syntax-case stx () [(_ body ...) (with-syntax ([sub-id (datum->syntax stx 'sub)]) #'(#%module-begin (module sub-id racket/base (define x 2) (provide x)) (require 'sub-id) (provide (all-from-out 'sub-id)) body ...))]))) On Sat, Aug 15, 2015 at 9:56 PM, Alexander D. Knauth wrote: > > On Aug 15, 2015, at 11:53 PM, Alexander D. Knauth > wrote: > > > Does this work? > > (define-syntax my-module-begin > > (lambda (stx) > >(syntax-case stx () > > [(_ body ...) > > (with-syntax ([sub-id (datum->syntax stx ''sub)]) > > #'(#%module-begin > > (module sub-id racket/base > > (define x 2) > > (provide x)) > > (require sub-id) > > (provide (all-from-out sub-id)) > > body ...))]))) > > I just realized that's not your example, so anyway, does modifying your > example to use (datum->syntax stx ''sub) instead of (datum->syntax stx > 'sub) work? > > -- 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.
Re: [racket-users] how to wrap a #lang module for the REPL?
On Aug 15, 2015, at 11:53 PM, Alexander D. Knauth wrote: > Does this work? > (define-syntax my-module-begin > (lambda (stx) >(syntax-case stx () > [(_ body ...) > (with-syntax ([sub-id (datum->syntax stx ''sub)]) > #'(#%module-begin > (module sub-id racket/base > (define x 2) > (provide x)) > (require sub-id) > (provide (all-from-out sub-id)) > body ...))]))) I just realized that's not your example, so anyway, does modifying your example to use (datum->syntax stx ''sub) instead of (datum->syntax stx 'sub) work? -- 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.
Re: [racket-users] how to wrap a #lang module for the REPL?
On Aug 15, 2015, at 9:50 PM, Matthew Butterick wrote: > BTW, is it possible to extend your solution to macro-introduced imports from > a submodule? > > In the original case, the identifier name was known in advance: > But suppose instead the identifiers come from a submodule. I see from the > docs for `all-from-out` that "macro-introduced imports are not re-exported, > unless the module-path was introduced at the same time", so it feels like it > should go something like this, though this doesn't work (there's a difference > between the unquoted and quoted name that I'm not capturing). > > (define-syntax my-module-begin > (lambda (stx) > (syntax-case stx () > [(_ body ...) >(with-syntax ([sub-id (datum->syntax stx 'sub)]) > #'(#%module-begin > (module sub-id racket/base >(define x 2) >(provide x)) > (require sub-id) > (provide (all-from-out sub-id)) > body ...))]))) Does this work? (define-syntax my-module-begin (lambda (stx) (syntax-case stx () [(_ body ...) (with-syntax ([sub-id (datum->syntax stx ''sub)]) #'(#%module-begin (module sub-id racket/base (define x 2) (provide x)) (require sub-id) (provide (all-from-out sub-id)) body ...))]))) > On Aug 15, 2015, at 6:21 PM, Matthew Butterick wrote: > >> Of your suggestions, I couldn't get `syntax-local-introduce` to work, but >> `datum->syntax` did. That made the macro-introduced identifier accessible at >> the REPL. Thanks. >> >> However, I also wanted to set up the #lang so that DrRacket would >> automatically print the value of `id` when it ran the file. I noticed I >> could do this by introducing a `(module+ test ...)` in the #lang itself that >> prints `id` (because by default, DrRacket automatically runs test >> submodules). Thus obviating the need for a wrapper module. >> >> >> >> >> >> On Aug 15, 2015, at 5:08 PM, Matthew Butterick wrote: >> >>> Probably the wiser option. I'll see if I can adapt that solution. >>> >>> >>> On Aug 15, 2015, at 4:31 PM, Alexander D. Knauth >>> wrote: >>> What kind of funny stuff? By the way, this sounds sort of like this http://www.mail-archive.com/racket-users@googlegroups.com/msg28020.html Solution: http://www.mail-archive.com/racket-users@googlegroups.com/msg28031.html Although it could be a completely different problem, I don't know. On Aug 15, 2015, at 6:22 PM, Matthew Butterick wrote: > I have a #lang that does some funny stuff with #%module-begin (maybe too > funny), the result being that when I run it in DrRacket, the `provide`d > identifiers aren't visible at the top level: > > (module my-lang-module my-lang > ... > (define id 42) > (provide id)) > >> id > id : undefined; > cannot reference undefined identifier > > > I've found a simple cure (maybe too simple) whereby I wrap my-lang-module > with the usual racket/base module, which satisfies DrRacket: > > > (module repl-wrapper racket/base > (module my-lang-module my-lang > ... > (define id 42) > (provide id)) > (require 'my-lang-module) > (provide (all-from-out 'my-lang-module)) > >> id > 42 > > > Question: is there an approved way to make this #lang-wrapping happen for > the REPL, and only for the REPL? AFAICT `#%top-interaction` is not the > cure, because it wraps the commands coming off the REPL (as opposed to > the code in the definitions window). > > -- > 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. >>> >> > -- 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.
Re: [racket-users] how to wrap a #lang module for the REPL?
On Aug 15, 2015, at 8:21 PM, Matthew Butterick wrote: > Of your suggestions, I couldn't get `syntax-local-introduce` to work, but > `datum->syntax` did. That made the macro-introduced identifier accessible at > the REPL. Thanks. > > However, I also wanted to set up the #lang so that DrRacket would > automatically print the value of `id` when it ran the file. I noticed I could > do this by introducing a `(module+ test ...)` in the #lang itself that prints > `id` (because by default, DrRacket automatically runs test submodules). Thus > obviating the need for a wrapper module. I think a better way of doing that would be using a runtime-config module as in: http://docs.racket-lang.org/guide/module-runtime-config.html Or I think you can also do that with a #%configure-runtime sudmodule (or something like that)? > On Aug 15, 2015, at 5:08 PM, Matthew Butterick wrote: > >> Probably the wiser option. I'll see if I can adapt that solution. >> >> >> On Aug 15, 2015, at 4:31 PM, Alexander D. Knauth >> wrote: >> >>> What kind of funny stuff? >>> By the way, this sounds sort of like this >>> http://www.mail-archive.com/racket-users@googlegroups.com/msg28020.html >>> Solution: >>> http://www.mail-archive.com/racket-users@googlegroups.com/msg28031.html >>> >>> Although it could be a completely different problem, I don't know. >>> >>> On Aug 15, 2015, at 6:22 PM, Matthew Butterick wrote: >>> I have a #lang that does some funny stuff with #%module-begin (maybe too funny), the result being that when I run it in DrRacket, the `provide`d identifiers aren't visible at the top level: (module my-lang-module my-lang ... (define id 42) (provide id)) > id id : undefined; cannot reference undefined identifier I've found a simple cure (maybe too simple) whereby I wrap my-lang-module with the usual racket/base module, which satisfies DrRacket: (module repl-wrapper racket/base (module my-lang-module my-lang ... (define id 42) (provide id)) (require 'my-lang-module) (provide (all-from-out 'my-lang-module)) > id 42 Question: is there an approved way to make this #lang-wrapping happen for the REPL, and only for the REPL? AFAICT `#%top-interaction` is not the cure, because it wraps the commands coming off the REPL (as opposed to the code in the definitions window). -- 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. >>> >> > -- 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.
Re: [racket-users] how to wrap a #lang module for the REPL?
BTW, is it possible to extend your solution to macro-introduced imports from a submodule? In the original case, the identifier name was known in advance: (define-syntax my-module-begin (lambda (stx) (syntax-case stx () [(_ body ...) (with-syntax ([x-id (datum->syntax stx 'x)]) #'(#%module-begin (define x-id 2) body ...))]))) But suppose instead the identifiers come from a submodule. I see from the docs for `all-from-out` that "macro-introduced imports are not re-exported, unless the module-path was introduced at the same time", so it feels like it should go something like this, though this doesn't work (there's a difference between the unquoted and quoted name that I'm not capturing). (define-syntax my-module-begin (lambda (stx) (syntax-case stx () [(_ body ...) (with-syntax ([sub-id (datum->syntax stx 'sub)]) #'(#%module-begin (module sub-id racket/base (define x 2) (provide x)) (require sub-id) (provide (all-from-out sub-id)) body ...))]))) On Aug 15, 2015, at 6:21 PM, Matthew Butterick wrote: > Of your suggestions, I couldn't get `syntax-local-introduce` to work, but > `datum->syntax` did. That made the macro-introduced identifier accessible at > the REPL. Thanks. > > However, I also wanted to set up the #lang so that DrRacket would > automatically print the value of `id` when it ran the file. I noticed I could > do this by introducing a `(module+ test ...)` in the #lang itself that prints > `id` (because by default, DrRacket automatically runs test submodules). Thus > obviating the need for a wrapper module. > > > > > > On Aug 15, 2015, at 5:08 PM, Matthew Butterick wrote: > >> Probably the wiser option. I'll see if I can adapt that solution. >> >> >> On Aug 15, 2015, at 4:31 PM, Alexander D. Knauth >> wrote: >> >>> What kind of funny stuff? >>> By the way, this sounds sort of like this >>> http://www.mail-archive.com/racket-users@googlegroups.com/msg28020.html >>> Solution: >>> http://www.mail-archive.com/racket-users@googlegroups.com/msg28031.html >>> >>> Although it could be a completely different problem, I don't know. >>> >>> On Aug 15, 2015, at 6:22 PM, Matthew Butterick wrote: >>> I have a #lang that does some funny stuff with #%module-begin (maybe too funny), the result being that when I run it in DrRacket, the `provide`d identifiers aren't visible at the top level: (module my-lang-module my-lang ... (define id 42) (provide id)) > id id : undefined; cannot reference undefined identifier I've found a simple cure (maybe too simple) whereby I wrap my-lang-module with the usual racket/base module, which satisfies DrRacket: (module repl-wrapper racket/base (module my-lang-module my-lang ... (define id 42) (provide id)) (require 'my-lang-module) (provide (all-from-out 'my-lang-module)) > id 42 Question: is there an approved way to make this #lang-wrapping happen for the REPL, and only for the REPL? AFAICT `#%top-interaction` is not the cure, because it wraps the commands coming off the REPL (as opposed to the code in the definitions window). -- 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. >>> >> > -- 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.
Re: [racket-users] how to wrap a #lang module for the REPL?
Of your suggestions, I couldn't get `syntax-local-introduce` to work, but `datum->syntax` did. That made the macro-introduced identifier accessible at the REPL. Thanks. However, I also wanted to set up the #lang so that DrRacket would automatically print the value of `id` when it ran the file. I noticed I could do this by introducing a `(module+ test ...)` in the #lang itself that prints `id` (because by default, DrRacket automatically runs test submodules). Thus obviating the need for a wrapper module. On Aug 15, 2015, at 5:08 PM, Matthew Butterick wrote: > Probably the wiser option. I'll see if I can adapt that solution. > > > On Aug 15, 2015, at 4:31 PM, Alexander D. Knauth wrote: > >> What kind of funny stuff? >> By the way, this sounds sort of like this >> http://www.mail-archive.com/racket-users@googlegroups.com/msg28020.html >> Solution: >> http://www.mail-archive.com/racket-users@googlegroups.com/msg28031.html >> >> Although it could be a completely different problem, I don't know. >> >> On Aug 15, 2015, at 6:22 PM, Matthew Butterick wrote: >> >>> I have a #lang that does some funny stuff with #%module-begin (maybe too >>> funny), the result being that when I run it in DrRacket, the `provide`d >>> identifiers aren't visible at the top level: >>> >>> (module my-lang-module my-lang >>> ... >>> (define id 42) >>> (provide id)) >>> id >>> id : undefined; >>> cannot reference undefined identifier >>> >>> >>> I've found a simple cure (maybe too simple) whereby I wrap my-lang-module >>> with the usual racket/base module, which satisfies DrRacket: >>> >>> >>> (module repl-wrapper racket/base >>> (module my-lang-module my-lang >>> ... >>> (define id 42) >>> (provide id)) >>> (require 'my-lang-module) >>> (provide (all-from-out 'my-lang-module)) >>> id >>> 42 >>> >>> >>> Question: is there an approved way to make this #lang-wrapping happen for >>> the REPL, and only for the REPL? AFAICT `#%top-interaction` is not the >>> cure, because it wraps the commands coming off the REPL (as opposed to the >>> code in the definitions window). >>> >>> -- >>> 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. >> > -- 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.
Re: [racket-users] how to wrap a #lang module for the REPL?
Probably the wiser option. I'll see if I can adapt that solution. On Aug 15, 2015, at 4:31 PM, Alexander D. Knauth wrote: > What kind of funny stuff? > By the way, this sounds sort of like this > http://www.mail-archive.com/racket-users@googlegroups.com/msg28020.html > Solution: > http://www.mail-archive.com/racket-users@googlegroups.com/msg28031.html > > Although it could be a completely different problem, I don't know. > > On Aug 15, 2015, at 6:22 PM, Matthew Butterick wrote: > >> I have a #lang that does some funny stuff with #%module-begin (maybe too >> funny), the result being that when I run it in DrRacket, the `provide`d >> identifiers aren't visible at the top level: >> >> (module my-lang-module my-lang >> ... >> (define id 42) >> (provide id)) >> >>> id >> id : undefined; >> cannot reference undefined identifier >> >> >> I've found a simple cure (maybe too simple) whereby I wrap my-lang-module >> with the usual racket/base module, which satisfies DrRacket: >> >> >> (module repl-wrapper racket/base >> (module my-lang-module my-lang >> ... >> (define id 42) >> (provide id)) >> (require 'my-lang-module) >> (provide (all-from-out 'my-lang-module)) >> >>> id >> 42 >> >> >> Question: is there an approved way to make this #lang-wrapping happen for >> the REPL, and only for the REPL? AFAICT `#%top-interaction` is not the cure, >> because it wraps the commands coming off the REPL (as opposed to the code in >> the definitions window). >> >> -- >> 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. > -- 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.
Re: [racket-users] how to wrap a #lang module for the REPL?
What kind of funny stuff? By the way, this sounds sort of like this http://www.mail-archive.com/racket-users@googlegroups.com/msg28020.html Solution: http://www.mail-archive.com/racket-users@googlegroups.com/msg28031.html Although it could be a completely different problem, I don't know. On Aug 15, 2015, at 6:22 PM, Matthew Butterick wrote: > I have a #lang that does some funny stuff with #%module-begin (maybe too > funny), the result being that when I run it in DrRacket, the `provide`d > identifiers aren't visible at the top level: > > (module my-lang-module my-lang > ... > (define id 42) > (provide id)) > >> id > id : undefined; > cannot reference undefined identifier > > > I've found a simple cure (maybe too simple) whereby I wrap my-lang-module > with the usual racket/base module, which satisfies DrRacket: > > > (module repl-wrapper racket/base > (module my-lang-module my-lang >... >(define id 42) >(provide id)) > (require 'my-lang-module) > (provide (all-from-out 'my-lang-module)) > >> id > 42 > > > Question: is there an approved way to make this #lang-wrapping happen for the > REPL, and only for the REPL? AFAICT `#%top-interaction` is not the cure, > because it wraps the commands coming off the REPL (as opposed to the code in > the definitions window). > > -- > 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. -- 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.
[racket-users] how to wrap a #lang module for the REPL?
I have a #lang that does some funny stuff with #%module-begin (maybe too funny), the result being that when I run it in DrRacket, the `provide`d identifiers aren't visible at the top level: (module my-lang-module my-lang ... (define id 42) (provide id)) > id id : undefined; cannot reference undefined identifier I've found a simple cure (maybe too simple) whereby I wrap my-lang-module with the usual racket/base module, which satisfies DrRacket: (module repl-wrapper racket/base (module my-lang-module my-lang ... (define id 42) (provide id)) (require 'my-lang-module) (provide (all-from-out 'my-lang-module)) > id 42 Question: is there an approved way to make this #lang-wrapping happen for the REPL, and only for the REPL? AFAICT `#%top-interaction` is not the cure, because it wraps the commands coming off the REPL (as opposed to the code in the definitions window). -- 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.