[gambit-list] Hygienic macros failing?

Jens Axel Søgaard jensaxel at soegaard.net
Mon Aug 20 02:17:42 EDT 2007


Adrien Pierard wrote:
> Hi.
> 
>> I may be misunderstanding hygienic macros here, but as far as I can tell I
>> am getting variable capture.
> 
> I don't use hygienic macros either but
> 
>> This displays (7 8 9) when arg2 should be (1 2 3) (the value of a b c in
>> the calling code, not the value in "bad").
> 
> Bigloo prints (7 8 9) and Gauche prints (1 2 3)
> Chicken, guile, mzscheme and petite all fail with macro error, or
> receive error.

You probably forgot to import "receive". Here is what happens
in mzscheme:

 > (require (lib "8.ss" "srfi"))

 > (define-syntax bad
    (syntax-rules ()
      ((_ (arg1 ...) (arg2 ...))
       (receive (a b c) (values arg1 ...)
         (newline)
         (write (list arg2 ...))))))

 > (receive (a b c) (values 1 2 3) (bad (7 8 9) (a b c)))
(1 2 3)

-- 
Jens Axel Søgaard




More information about the Gambit-list mailing list