[racket-users] Re: #%module-begin with module+

2018-09-12 Thread Milo Turner
The reason for it using racket/base's #%module-begin is the same reasoning for 
how racket/base's #%app is inserted in a #lang racket module (and more 
crucially, inserted by macros defined in that module, no matter where the macro 
is used)

-- 
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] Re: #%module-begin with module+

2018-09-04 Thread Philip McGrath
Inspired by
https://groups.google.com/d/msg/racket-users/H7vilh3KcD4/WoKcRUXe-PAJ, I
have a strange but simple workaround. Essentially, I added a module like:

#lang racket
(require syntax/parse/define)
(provide (rename-out
  [child-module+ module+]
  [child-module* module*]))
(define-syntax-parser child-module+
 [(_ . stuff)
   #'(module+ . stuff)])
(define-syntax-parser child-module*
  [(_ . stuff)
   #'(module* . stuff)])

The exported versions of `module+` and `module*` (for the `(module* child
#f ...)` case) carry the `#%module-begin` from `#lang racket` along with
them. This strikes me as very strange, and there are probably deeper
subtleties it doesn't address, but it solves my immediate issues.

-Philip


On Tue, Sep 4, 2018 at 6:19 PM Philip McGrath 
wrote:

> Is there a way to control what version of `#%module-begin` is introduced
> for a `module+` submodule?
>
> I have a DSL that is implemented by doing some fairly strange things with
> `#%module-begin`, but I want to reuse `module+` in the DSL. The submodules
> should be able to see all of the bindings from the parent module as usual,
> but I want them to use the normal `#%module-begin` from `racket/base`, not
> the crazy one from the parent module. (The same goes for `(module* child #f
> ...)`, but I think it might be easier to add a wrapper around `module*`
> than to re-implement `module+`.)
>
> -Philip
>

-- 
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.