GNU bug report logs - #14859
my-or macro in documentation

Previous Next

Package: guile;

Reported by: Josep Portella Florit <jpf <at> primfilat.com>

Date: Sat, 13 Jul 2013 19:12:01 UTC

Severity: normal

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14859 in the body.
You can then email your comments to 14859 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#14859; Package guile. (Sat, 13 Jul 2013 19:12:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Josep Portella Florit <jpf <at> primfilat.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sat, 13 Jul 2013 19:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Josep Portella Florit <jpf <at> primfilat.com>
To: bug-guile <at> gnu.org
Subject: my-or macro in documentation
Date: Sat, 13 Jul 2013 20:52:45 +0200
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




Reply sent to Mark H Weaver <mhw <at> netris.org>:
You have taken responsibility. (Sun, 14 Jul 2013 00:42:01 GMT) Full text and rfc822 format available.

Notification sent to Josep Portella Florit <jpf <at> primfilat.com>:
bug acknowledged by developer. (Sun, 14 Jul 2013 00:42:02 GMT) Full text and rfc822 format available.

Message #10 received at 14859-done <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: Josep Portella Florit <jpf <at> primfilat.com>
Cc: 14859-done <at> debbugs.gnu.org
Subject: Re: bug#14859: my-or macro in documentation
Date: Sat, 13 Jul 2013 20:41:24 -0400
Hi!

Josep Portella Florit <jpf <at> primfilat.com> 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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 11 Aug 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 7 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.