[racket] scoping rules and define-for-syntax

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Jul 25 08:02:01 EDT 2010

At Sun, 25 Jul 2010 03:12:15 -0400, Eli Barzilay wrote:
> On Jul 24, Shriram Krishnamurthi wrote:
> > [...]
> > 
> > This, however, is just an illustrative simplification of my real
> > program, which has non-trivial mutually-referential functions.  The
> > only solution I have is effectively
> > 
> >   (define-for-syntax (shell e)
> > 
> >     (define (f1 e) ...)
> >     (define (f3 e) ...)
> > 
> >     (f3 e))
> > 
> > which works, but is pretty unsatisfactory.
> 
> (See also PR7104 -- it was an issue in the ffi code, which I worked
> around with a parameter...)

This limitation is due to the mutual dependency between (1) compiling
and running for-syntax expressions at expansion time and (2)
discovering bindings during the process of expansion.

I'll document the limitation, and hopefully we'll be able to fix it
when we work on more general support for higher-phase bindings in a
module.



Posted on the users mailing list.