From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.bugs Subject: bug#38263: Bug in srfi-11 Date: Sun, 24 Nov 2019 14:55:30 -0500 Message-ID: <878so5122a.fsf@netris.org> References: <87blt76eum.fsf.ref@yahoo.de> <87blt76eum.fsf@yahoo.de> <87pnhh1x4o.fsf@netris.org> <87r21x9k9f.fsf@yahoo.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="102650"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 38263@debbugs.gnu.org To: Tim Gesthuizen Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Nov 25 14:26:09 2019 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iZENV-000QYn-P8 for guile-bugs@m.gmane.org; Mon, 25 Nov 2019 14:26:09 +0100 Original-Received: from localhost ([::1]:43940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZENU-0004W0-Eu for guile-bugs@m.gmane.org; Mon, 25 Nov 2019 08:26:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42136) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZENP-0004Vs-9J for bug-guile@gnu.org; Mon, 25 Nov 2019 08:26:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZENN-0002FF-Vr for bug-guile@gnu.org; Mon, 25 Nov 2019 08:26:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41965) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZENN-0002F7-QF for bug-guile@gnu.org; Mon, 25 Nov 2019 08:26:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iZENN-0006Hv-LQ for bug-guile@gnu.org; Mon, 25 Nov 2019 08:26:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 25 Nov 2019 13:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38263 X-GNU-PR-Package: guile Original-Received: via spool by 38263-submit@debbugs.gnu.org id=B38263.157468835524156 (code B ref 38263); Mon, 25 Nov 2019 13:26:01 +0000 Original-Received: (at 38263) by debbugs.gnu.org; 25 Nov 2019 13:25:55 +0000 Original-Received: from localhost ([127.0.0.1]:47937 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iZENH-0006HY-JT for submit@debbugs.gnu.org; Mon, 25 Nov 2019 08:25:55 -0500 Original-Received: from world.peace.net ([64.112.178.59]:38646) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iZENF-0006HP-Pt for 38263@debbugs.gnu.org; Mon, 25 Nov 2019 08:25:54 -0500 Original-Received: from mhw by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iYxzv-0004fa-9M; Sun, 24 Nov 2019 14:56:43 -0500 In-Reply-To: <87r21x9k9f.fsf@yahoo.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:9467 Archived-At: --=-=-= Content-Type: text/plain Hi Tim, > Mark H Weaver writes: >> 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. > > Oops, that `let` should have been a `let*` (Moving the first a into > scope). But if you could verify that what I described is a bug I would > like to propose a patch. I agree that it's a bug, and that if you change 'let' to 'let*' in your previous example, the result should be '(9 2 (3) (4)). I took a quick look, and I believe the fix is simply to swap 'new-var' and 'new-tmp' on line 95 of srfi-11.scm. See the attached patch. Does it fix the problems you're seeing? Thanks, Mark --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-let-values-where-formals-is-an-improper-list.patch Content-Description: [PATCH] Fix 'let-values' where is an improper list >From 4657b95713facffcde685b578ed19dbeb45624d0 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sun, 24 Nov 2019 14:46:45 -0500 Subject: [PATCH] Fix 'let-values' where is an improper list. Fixes . Reported by Tim Gesthuizen . * module/srfi/srfi-11.scm (let-values): Swap 'new-tmp' and 'new-var' in the pair pattern, to match the code that creates those pairs. --- module/srfi/srfi-11.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/srfi/srfi-11.scm b/module/srfi/srfi-11.scm index 22bda21a2..42b8527ba 100644 --- a/module/srfi/srfi-11.scm +++ b/module/srfi/srfi-11.scm @@ -1,6 +1,7 @@ ;;; srfi-11.scm --- let-values and let*-values -;; Copyright (C) 2000, 2001, 2002, 2004, 2006, 2009 Free Software Foundation, Inc. +;; Copyright (C) 2000, 2001, 2002, 2004, 2006, 2009, +;; 2019 Free Software Foundation, Inc. ;; ;; This library is free software; you can redistribute it and/or ;; modify it under the terms of the GNU Lesser General Public @@ -91,7 +92,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) -- 2.24.0 --=-=-=--