GNU bug report logs - #14203
Manual: 'my-or'; 'let' inside macros

Previous Next

Package: guile;

Reported by: Nikita Karetnikov <nikita <at> karetnikov.org>

Date: Sun, 14 Apr 2013 16:35:02 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Nikita Karetnikov <nikita <at> karetnikov.org>
To: 14203 <at> debbugs.gnu.org
Subject: bug#14203: Manual: 'my-or'; 'let' inside macros
Date: Sun, 14 Apr 2013 20:33:12 +0400
[Message part 1 (text/plain, inline)]
I think this example [1,2]:

(define-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 ...))))))

should look like this:

(define-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 ...))))))

Otherwise, what's the rationale behind 'let'?

AFAICT, it's described here [3], but Guile is not affected, right?  So
the following works as well:

(define-syntax my-or
  (syntax-rules ()
    ((my-or)
     #t)
    ((my-or exp)
     exp)
    ((my-or exp rest ...)
     (if exp
         exp
         (my-or rest ...)))))

Note that 'my-or' is used in several places (e.g., [4]) and it's
necessary to change them all.  Also, there are other macros that use
'let' (e.g., 'cond1').

[1] https://gnu.org/software/guile/manual/guile.html#Defining-Macros
[2] https://gnu.org/software/guile/manual/guile.html#Hygiene
[3] http://stackoverflow.com/a/3215238
[4] https://gnu.org/software/guile/manual/guile.html#Syntax-Case
[Message part 2 (application/pgp-signature, inline)]

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

Previous Next


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