[plt-scheme] module-begin
Matthew Flatt skrev:
> 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)))]))
> (re-export-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).
Thanks, it works exactly like needed.
--
Jens Axel Søgaard