mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
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.
This commit is contained in:
parent
7726ed7423
commit
1733efe236
2 changed files with 9 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue