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

From: Felix Klock's PLT scheme proxy (pltscheme at pnkfx.org)
Date: Tue Jul 29 00:39:45 EDT 2003

Matthew et al.-

> 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)
>  =>
>   (begin
>     (define-syntaxes () (mutate! ...))
>     FOO)
> If I'm on track, this is what 3.2.2 of the "Composable and Compilable
> Macros" paper is trying to explain.

Before I get flamed; I just realized that Matthew was *not* suggesting 
that I turn b-syntax-mutate! into a runtime-evaluated-mutation, which 
is what I interpreted his response as saying.  In my half-awake state, 
I managed to simultaneously misinterpret his english text, misread his 
illustrated sexp transform, and ignore the reference to section 3.2.2 
of the paper (which I still have not finished rereading).  So I 
apologize for suggesting in my reply that your suggestion was of no use.

So, I'm going to finish reading the C&CM paper before I write any more 
replies.  I just wanted to head off any heated responses at the pass.

(In my defense, most of the words in my last email were spent 
explaining my current predicament, and not actually discrediting the 
approach Matthew suggested.  So they were not a total waste, right...?)

Thanks again,

p.s. the need for compile-time expression evaluation seems severe 
enough for cases like this, that perhaps it would be sensible to add a 
BEGIN-FOR-SYNTAX construct to MzScheme, such as:
   (define-syntax BEGIN-FOR-SYNTAX
      (syntax-rules ()
          [(begin-for-syntax expr ...)
           (define-syntaxes () (begin expr ...))]))
just a thought... if such a construct existed, I might have thought to 
experiment with it before sending out the original email...

Posted on the users mailing list.