emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#14859: closed (my-or macro in documentation)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#14859: closed (my-or macro in documentation)
Date: Sun, 14 Jul 2013 00:42:01 +0000

Your message dated Sat, 13 Jul 2013 20:41:24 -0400
with message-id <address@hidden>
and subject line Re: bug#14859: my-or macro in documentation
has caused the debbugs.gnu.org bug report #14859,
regarding my-or macro in documentation
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
14859: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14859
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: my-or macro in documentation Date: Sat, 13 Jul 2013 20:52:45 +0200 User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7
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



--- End Message ---
--- Begin Message --- Subject: Re: bug#14859: my-or macro in documentation Date: Sat, 13 Jul 2013 20:41:24 -0400 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Hi!

Josep Portella Florit <address@hidden> 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


--- End Message ---

reply via email to

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