bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#38263: Bug in srfi-11


From: Andy Wingo
Subject: bug#38263: Bug in srfi-11
Date: Sun, 12 Jan 2020 22:23:21 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Applied to both branches.  Thanks for the patch and thanks also to Mark
for the review and initial patch!

In the future, Tim, if you have larger patches, we should work out
copyright assignment paperwork.  But less-than-10-line patches are fine
without.  Let me know if this is of interest to you.  Cheers :)

Andy

On Tue 03 Dec 2019 19:15, Tim Gesthuizen via "Bug reports for GUILE, GNU's 
Ubiquitous Extension Language" <address@hidden> writes:

> Hello again,
>
> the attached patch also adds a unit test.
> I am not into how Guile is organized: Is there anything keeping us from
> adding the change?
>
> Tim.
>
> From 99d8fb795932eb92b7d5fb09115b6691f4bfe66d Mon Sep 17 00:00:00 2001
> From: Tim Gesthuizen <address@hidden>
> Date: Tue, 3 Dec 2019 18:50:37 +0100
> Subject: [PATCH] srfi-11: Do not expose variables to later clauses
>
> The current implementation of srfi-11s let-values allows later clauses
> to access and modify variables bound in earlier clauses when the clause
> is not a proper list.
>
> * module/srfi/srfi-11.scm (let-values): Fix switched variable names.
> * test-suite/tests/srfi-11.test (let-values): Add test checking that the
>   variable cannot be changed in later clauses.
> ---
>  module/srfi/srfi-11.scm       | 2 +-
>  test-suite/tests/srfi-11.test | 9 ++++++++-
>  2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/module/srfi/srfi-11.scm b/module/srfi/srfi-11.scm
> index 22bda21a2..7afac9c5f 100644
> --- a/module/srfi/srfi-11.scm
> +++ b/module/srfi/srfi-11.scm
> @@ -91,7 +91,7 @@
>                      (syntax (call-with-values (lambda () exp)
>                                (lambda (new-tmp ...) inner))))))
>                 ((vars exp)
> -                (with-syntax ((((new-tmp . new-var) ...)
> +                (with-syntax ((((new-var . new-tmp) ...)
>                                 (let lp ((vars (syntax vars)))
>                                   (syntax-case vars ()
>                                     ((id . rest)
> diff --git a/test-suite/tests/srfi-11.test b/test-suite/tests/srfi-11.test
> index 40563dc18..9bfaa4300 100644
> --- a/test-suite/tests/srfi-11.test
> +++ b/test-suite/tests/srfi-11.test
> @@ -74,7 +74,14 @@
>       '(unbound-variable . ".*")
>        (let-values (((x) (values 1))
>                  ((y) (values (1+ x))))
> -     #f))))
> +     #f))
> +
> +    (pass-if "first binding with rest invisible to second expr"
> +      (let* ((a 1)
> +             (b (let-values (((a . b) (values 2 3))
> +                             (c (begin (set! a 9) 4)))
> +                  (list a b c))))
> +        (equal? (cons a b) '(9 2 (3) (4)))))))
>  
>  ;;
>  ;; let*-values





reply via email to

[Prev in Thread] Current Thread [Next in Thread]