From unknown Sat Aug 16 16:56:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14859: my-or macro in documentation Resent-From: Josep Portella Florit Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 13 Jul 2013 19:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14859 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 14859@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1373742701330 (code B ref -1); Sat, 13 Jul 2013 19:12:01 +0000 Received: (at submit) by debbugs.gnu.org; 13 Jul 2013 19:11:41 +0000 Received: from localhost ([127.0.0.1]:53150 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uy5EK-00005E-Ao for submit@debbugs.gnu.org; Sat, 13 Jul 2013 15:11:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44347) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uy4wN-0007wW-FV for submit@debbugs.gnu.org; Sat, 13 Jul 2013 14:53:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uy4wF-0003CE-TJ for submit@debbugs.gnu.org; Sat, 13 Jul 2013 14:53:02 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:43640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy4wF-0003C8-QL for submit@debbugs.gnu.org; Sat, 13 Jul 2013 14:52:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy4wC-0007pT-Sp for bug-guile@gnu.org; Sat, 13 Jul 2013 14:52:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uy4wA-0003BW-CV for bug-guile@gnu.org; Sat, 13 Jul 2013 14:52:56 -0400 Received: from primfilat.com ([71.19.154.166]:45794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy4wA-0003BG-6H for bug-guile@gnu.org; Sat, 13 Jul 2013 14:52:54 -0400 Received: from [192.168.0.2] (unknown [46.18.41.120]) by primfilat.com (Postfix) with ESMTPSA id 006547B8F9 for ; Sat, 13 Jul 2013 20:58:52 +0200 (CEST) Message-ID: <51E1A1FD.8000104@primfilat.com> Date: Sat, 13 Jul 2013 20:52:45 +0200 From: Josep Portella Florit User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Sat, 13 Jul 2013 15:11:38 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hi! The my-or example macro in the documentation has a subtle bug. (letrec-syntax ((my-or (syntax-rules () ((my-or) #t) ((my-or exp) exp) ((my-or exp rest ...) (let ((t exp)) (if exp exp (my-or rest ...))))))) (my-or #f "rockaway beach")) In the third rule t is bound to exp, presumably to use t instead of exp to prevent evaluating exp multiple times, but t is never used and exp is used again. This is the bug in action: scheme@(guile-user)> (letrec-syntax ((my-or (syntax-rules () ((my-or) #t) ((my-or exp) exp) ((my-or exp rest ...) (let ((t exp)) (if exp exp (my-or rest ...))))))) (my-or (display "*") 1)) ***scheme@(guile-user)> I'm sure you already know how to fix it :-) (letrec-syntax ((my-or (syntax-rules () ((my-or) #t) ((my-or exp) exp) ((my-or exp rest ...) (let ((t exp)) (if t t (my-or rest ...))))))) (my-or #f "rockaway beach")) Josep From unknown Sat Aug 16 16:56:28 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Josep Portella Florit Subject: bug#14859: closed (Re: bug#14859: my-or macro in documentation) Message-ID: References: <87d2qm6ki3.fsf@tines.lan> <51E1A1FD.8000104@primfilat.com> X-Gnu-PR-Message: they-closed 14859 X-Gnu-PR-Package: guile Reply-To: 14859@debbugs.gnu.org Date: Sun, 14 Jul 2013 00:42:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1373762522-19888-1" This is a multi-part message in MIME format... ------------=_1373762522-19888-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #14859: my-or macro in documentation which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 14859@debbugs.gnu.org. --=20 14859: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14859 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1373762522-19888-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 14859-done) by debbugs.gnu.org; 14 Jul 2013 00:41:55 +0000 Received: from localhost ([127.0.0.1]:53485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UyANu-0005AR-G0 for submit@debbugs.gnu.org; Sat, 13 Jul 2013 20:41:54 -0400 Received: from world.peace.net ([96.39.62.75]:51144 ident=hope3) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UyANr-0005AE-OM for 14859-done@debbugs.gnu.org; Sat, 13 Jul 2013 20:41:52 -0400 Received: from 209-6-120-240.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com ([209.6.120.240] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UyANk-0001qS-Fc; Sat, 13 Jul 2013 20:41:44 -0400 From: Mark H Weaver To: Josep Portella Florit Subject: Re: bug#14859: my-or macro in documentation References: <51E1A1FD.8000104@primfilat.com> Date: Sat, 13 Jul 2013 20:41:24 -0400 In-Reply-To: <51E1A1FD.8000104@primfilat.com> (Josep Portella Florit's message of "Sat, 13 Jul 2013 20:52:45 +0200") Message-ID: <87d2qm6ki3.fsf@tines.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 14859-done Cc: 14859-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Hi! Josep Portella Florit writes: > The my-or example macro in the documentation has a subtle bug. > > (letrec-syntax ((my-or > (syntax-rules () > ((my-or) > #t) > ((my-or exp) > exp) > ((my-or exp rest ...) > (let ((t exp)) > (if exp > exp > (my-or rest ...))))))) > (my-or #f "rockaway beach")) > > In the third rule t is bound to exp, presumably to use t instead of exp > to prevent evaluating exp multiple times, but t is never used and exp is > used again. Indeed! This was reported shortly after the 2.0.9 release, and has been fixed in the stable-2.0 branch. http://bugs.gnu.org/14203 http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commitdiff;h=e006d87ba5942b6e49b39b951413dfe63785a398 Thanks! Mark ------------=_1373762522-19888-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 13 Jul 2013 19:11:41 +0000 Received: from localhost ([127.0.0.1]:53150 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uy5EK-00005E-Ao for submit@debbugs.gnu.org; Sat, 13 Jul 2013 15:11:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44347) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uy4wN-0007wW-FV for submit@debbugs.gnu.org; Sat, 13 Jul 2013 14:53:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uy4wF-0003CE-TJ for submit@debbugs.gnu.org; Sat, 13 Jul 2013 14:53:02 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:43640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy4wF-0003C8-QL for submit@debbugs.gnu.org; Sat, 13 Jul 2013 14:52:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy4wC-0007pT-Sp for bug-guile@gnu.org; Sat, 13 Jul 2013 14:52:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uy4wA-0003BW-CV for bug-guile@gnu.org; Sat, 13 Jul 2013 14:52:56 -0400 Received: from primfilat.com ([71.19.154.166]:45794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy4wA-0003BG-6H for bug-guile@gnu.org; Sat, 13 Jul 2013 14:52:54 -0400 Received: from [192.168.0.2] (unknown [46.18.41.120]) by primfilat.com (Postfix) with ESMTPSA id 006547B8F9 for ; Sat, 13 Jul 2013 20:58:52 +0200 (CEST) Message-ID: <51E1A1FD.8000104@primfilat.com> Date: Sat, 13 Jul 2013 20:52:45 +0200 From: Josep Portella Florit User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: bug-guile@gnu.org Subject: my-or macro in documentation X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 13 Jul 2013 15:11:38 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hi! The my-or example macro in the documentation has a subtle bug. (letrec-syntax ((my-or (syntax-rules () ((my-or) #t) ((my-or exp) exp) ((my-or exp rest ...) (let ((t exp)) (if exp exp (my-or rest ...))))))) (my-or #f "rockaway beach")) In the third rule t is bound to exp, presumably to use t instead of exp to prevent evaluating exp multiple times, but t is never used and exp is used again. This is the bug in action: scheme@(guile-user)> (letrec-syntax ((my-or (syntax-rules () ((my-or) #t) ((my-or exp) exp) ((my-or exp rest ...) (let ((t exp)) (if exp exp (my-or rest ...))))))) (my-or (display "*") 1)) ***scheme@(guile-user)> I'm sure you already know how to fix it :-) (letrec-syntax ((my-or (syntax-rules () ((my-or) #t) ((my-or exp) exp) ((my-or exp rest ...) (let ((t exp)) (if t t (my-or rest ...))))))) (my-or #f "rockaway beach")) Josep ------------=_1373762522-19888-1--