[R6RS] modules

Matthew Flatt mflatt
Tue Aug 24 11:22:45 EDT 2004


At Tue, 24 Aug 2004 10:12:59 -0500 (EST), "R. Kent Dybvig" wrote:
> > How many times is the body of M evaluated? Is it just once, so that all
> > of the calls to `get-x' in N and P call the same function? ...
> 
> Again, I prefer just once.
> 
> > ... If so, what
> > mechanism allows the result to be treated differently in N and P?
> 
> Here's one approach:
> 
> * (require M) introduces a substitution marked "run-time" from each
>   import name to the corresponding export label.
> 
> * (require only-for-syntax M) introduces a substitution marked
>   "expand-time" from each import name to the corresponding export label.
> 
> * (require also-for-syntax M) introduces a substitution marked
>   "any-time" from each import name to the corresponding export label.
> 
> When expanding transformer code, the expander signals an error
> for attempted references through substitutions marked "run-time";
> otherwise, the expander signals an error for attempted references through
> substitutions marked "expand-time".

When is this substitution applied? To the result of a macro expansion?

In other words, does the macro expander know that it's expanding
`def-f-fun' from the module N, and therefore any `x' (from M) that is
introduced by `def-f-fun' should be replaced with a compile-time `x'
(from M)?

Matthew



More information about the R6RS mailing list