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

From: Per Bothner <per>
Date: Mon Mar 12 11:53:09 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/
Received on Mon Mar 12 2007 - 11:51:57 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC