[r6rs-discuss] [Formal] Internal define-syntax lexical scoping violation

AndrevanTonder andre at het.brown.edu
Tue Oct 24 10:57:31 EDT 2006


On Tue, 24 Oct 2006, Abdulaziz Ghuloum wrote:

> No.  Multipass expansion, as you describe it, is ambiguous.  Suppose that I 
> change your example slightly so that the outer bar is a macro (defined 
> externally), not a lexical variable:
>
>     (let ()
>       (bar x)
>       (define-syntax bar
>         (syntax-rules ()
>           ((bar x) (define x 1))))
>       x)

What I had in mind was a fixpoint of the current expansion algorithm.  So this 
would still be an error by the first paragraph of p.28, whereas my original 
example is not currently covered by this paragraph.

> PS: Did you implement this algorithm?

No.  I might play with it, but there may be other ways to fix the issue (I would 
probably be okay with an error being thrown of the type of p.28, just not the 
"expression before definition" error one would currently get, which is 
inconsistent with lexical scoping).  Maybe the algorithm in the first paragraph 
of p.28 can be fixed to detect this problem also.

Andre



More information about the r6rs-discuss mailing list