[R6RS] modules?

Matthew Flatt mflatt
Mon Apr 26 22:39:11 EDT 2004


At Mon, 26 Apr 2004 19:45:31 -0500 (EST), "R. Kent Dybvig" wrote:
> Our mechanism for establishing expand-time, or "meta", variable bindings
> is orthogonal to modules and allows us to have both expand-time and
> run-time variable bindings in the same module or lambda/let/letrec
> body, e.g.:

This is nice. I've been calling it `begin-for-syntax', but I never
implemented it, and I imagined creating `begin-for-syntax' only for
module top-levels.

> We do run into this, and the solution is simple: a macro-generating
> macro that introduces hidden definitions should expand into an anonymous
> module exporting the macro with its hidden exports.

Ah - I completely misunderstood the declaration requirement. In
particular, I didn't understand that a declaration is needed only in
the variable's immediate enclosing module.

> PS. I assume you meant to imply that "big computation" is performed only
> once in your system in the following:
> 
> > (module m mzscheme
> >   (define table ... #| big computation |# )
> >   (define (helper args) ...)
> >   (provide helper))
> > (module n mzscheme
> >   (require m)
> >   (require-for-syntax m)
> >   (define-syntax (macro stx) ... (helper arg) #| not in template |# ...)
> >   (define x ... (marco stx) ... (helper arg) ...))
> 
> But isn't it actually performed once as a result of the (require m)
> and once again as a result of the (require-for-syntax m)?

Right. I intended once (but only once) for each phase.

Matthew



More information about the R6RS mailing list