[plt-scheme] module-begin

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Jun 27 10:46:15 EDT 2006

At Tue, 27 Jun 2006 15:31:40 +0200, Jens Axel Søgaard wrote:
>    (require (prefix to- to))
>    (provide (rename to-#%datum #%datum))
> [...]
> But that solutions requires me to change code in "from" everytime I add
> new constructs in "to".
> Is there a more elegant solution?

This is a hack, but

 (define-syntax re-export-to
   (syntax-rules ()
     [(_) (begin 
            (require (all-except to #%module-begin))
            (provide (all-from to)))]))

should export everything except `#%module-begin' from `to' without
binding any of the `to' exports locally.

This trick works because the `to' in the `require' is macro-introduced,
so the imports bind only references introduced by the same macro (and
there aren't any).


Posted on the users mailing list.