[r6rs-discuss] [Formal] body should allow mixing declarations with expressions

Per Bothner per at bothner.com
Mon Mar 12 11:51:57 EDT 2007


Lauri Alanko wrote:
> There is a question of how this should be translated. If we have:
> 
> (let ()
>   (define a (foo))
>   (define b (bar))
>   (baz)
>   (define c (quux))
>   (quuux))
> 
> Then should it be translated as
> 
> (let ()
>   (letrec* ((a (foo))
>             (b (bar)))
>     (baz)
>     (letrec* ((c (quux)))
>       (quuux))))
> 
> or
> 
> (let ()
>   (letrec* ((a (foo))
>             (b (bar))
>             (dummy (baz))
>             (c (quux)))
>     (quuux)))

The latter.  That matches the 5.92 specification for top=level
bodies, and I think it's the Right Thing.

> The first way would allow redefining the same variable multiple times
> in a body, but I'd prefer the latter alternative, so that all
> expressions and definitions directly inside a body use the same
> scope. Moreover, I think that a definition should be allowed as the
> final element of a body. The body of the resulting letrec* expression
> would then be (unspecified).

I agree.
-- 
	--Per Bothner
per at bothner.com   http://per.bothner.com/



More information about the r6rs-discuss mailing list