[plt-scheme] multiple invocation via require-for-syntax

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Jul 29 00:29:15 EDT 2003

At Mon, 28 Jul 2003 13:20:06 -0400, "Felix Klock's plt proxy" wrote:
> This last paragraph implies (to me) that the single-invocation rule 
> should apply to both modules instantiated with REQUIRE-FOR-SYNTAX.  
> That is,
> (module A ...)
> (module B mzscheme (require-for-syntax a) ...)
> (module C mzscheme (require-for-syntax a) ...)
> (module D mzscheme (require b c) ...)
> One would think that B and C would share the same copy of the A module 
> at syntax-expansion time.

They share the same A instance while compiling D. But, compiling B then
C then D will result in three separate instantiations of A --- one for
each module compilation.

I think that's the problem in your example. Apologies if I've misread
your code, but I think the problem will be solved by having macros such
as `b-syntax-mutate!' expand into a compile-time expression that uses
`mutate!' instead of having `b-syntax-mutate!' call `mutate!' directly:

 (b-syntax-mutate! FOO)
    (define-syntaxes () (mutate! ...))

If I'm on track, this is what 3.2.2 of the "Composable and Compilable
Macros" paper is trying to explain.


Posted on the users mailing list.