Comment 3 for bug 216663

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote : Re: [Bug 216663] Re: letrec* not evaluating in defined order

On Apr 13, 2008, at 6:11 AM, leppie wrote:
> What kind of error should (letrec ((a a)) a) signal?
>
> Petite Chez says:
> Error: attempt to reference undefined variable a.
>
> But that is not really correct.

The value of a letrec-bound variable is undefined until after the
body of the letrec is entered. The value of a letrec*-bound variable
is undefined until after the right-hand-side expression is
evaluated. I don't see how Chez's behavior is "not really correct".
Can you elaborate?

>> From the R6RS spec it appears it requires it to be of type
>> &assertion.
>
> My feeling is this is a syntax error as it's detectable at compile
> time.

In general, such violations are not detectable at compile time, but
they can always be detected at run time.

For example, (letrec ((a (begin (foo) a))) a) evaluates correctly for
some values of foo but not for others, so, it cannot be a syntax error.

Aziz,,,