Subject: Re: bug#38263: Bug in srfi-11

From: Mark H Weaver <[email-masked]>
Date: Sun, 24 Nov 2019 03:44:28 -0500

Hi Tim,

Tim Gesthuizen <[email-masked]> wrote:

> Hi,
> I had a look today into the srfi-11 specificiation. It requires that the
> variables are bound to fresh locations so let me rephrase the bug:
>
>> (let ((a 1)
>>       (b (let-values (((a . b) (values 2 3))
>>                       (c (begin (set! a 9) 4)))
>>            (list a b c))))
>>   (cons a b))
>
> Evaluates to `(1 9 (3) (4))` while it should evaluate to
> `(9 2 (3) (4))`.

I agree that this example indicates a bug in Guile's 'let-values'
implementation (which was written by Andy Wingo in August 2009), but I
disagree that it should evaluate to '(9 2 (3) (4)).  I think that your
example should raise an error, because at the point where (set! a 9) is
found, neither of the 'a' variables are in scope.

     Regards,
       Mark