[plt-scheme] module-begin

From: Kimberley Burchett (kim.burchett at gmail.com)
Date: Fri Jul 14 21:25:54 EDT 2006

On 6/27/06, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> 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 for sharing this hack just in time for me to make use of it as
well.  It seems to work as long as the module name is a simple
identifier (such as "to" or "mzscheme"), but if I replace the module
name with (lib "frtime.ss" "frtime") then I get this error:

errortrace: unrecognized expression form at top-level: (require
(all-except (lib "frtime.ss" "frtime") #%module-begin))

Any clue what this means?  It seems to be coming from make-annotate in
errortrace/stacktrace.ss, even though make-annotate does have a case
for forms beginning with "require", which looks like it should match.

--
Kimberley Burchett
http://www.kimbly.com/


Posted on the users mailing list.