[plt-scheme] require-for-syntax issues

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Jul 10 12:24:39 EDT 2003

At Thu, 10 Jul 2003 12:01:54 -0400, "Felix Klock's PLT scheme proxy" wrote:
> 1. 'require-for-next' seems like a somewhat unintuitive name;

Agreed. I started to write just `require-for-ZZZ', because we haven't
found a good name.

> have you 
> considered alternatives like 'require-for-runtime' ? 

I worry that this sounds too much like phase 0 instead of -1.

> 2. Are you sure that you want to put the require-clause for the runtime 
> bindings into the syntax-providing module [utils in this case] ?  Would 
> a sensible alternative be to add a new kind of clause to 
> require-for-syntax that indicates what module, if any, should provide 
> the phase 0 bindings after the upward shift?

Neat idea, but two modules might use the same module for syntax:

  (module ct-utils ...)

  (module rt-left ... (require-for-syntax ct-utils) ...)

  (module rt-right ... (require-for-syntax ct-utils) ...)

  (module rt-bottom ... (require rt-left rt-right) ...)

When `rt-left' and `rt-right' both export macros that call functions in
`ct-utils', it's the same instance of `ct-utils'. If `rt-left' and
`rt-right' supplied different phase -1 bindings to `ct-utils', things
would fall apart.

This is a collision between a kind of dynamic scope (bindings in
`ct-utils' determined by the use of the module) and static scope
(bindings in `ct-utils' determined only by the surrounding text).


Posted on the users mailing list.