[R6RS] Yet another question (to Matthew I guess)

R. Kent Dybvig dyb
Thu Sep 30 12:33:13 EDT 2004


> Does it mean that the following program *must* raise an error:
> 
> -----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
> (module foo r6rs
> 
>  (display (foo 3))
> 
>  (define (foo x) x)
>  )
> -----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----

> If it does I don't see how the compiler will be able to do a good job
> when compiling function calls...

It turns out not to be difficult.  See:

  http://www.cs.indiana.edu/~dyb/pubs/fixing-letrec.pdf

The basic trick is to use a separate validity flag that says whether a
variable can legally be referenced.

> This syntax avoids wasting characters at the left side of the screen
> and it gets rid of this ugly closing parenthesis after the last
> definition of the last expression.

I had suggested something like this to Matthew a while back, but now I'm
inclined to leave it as a wrapper.  This allows us to put more than one
module in a file, among other things.

Kent


More information about the R6RS mailing list