chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] stressing the new hygienic macros


From: Michele Simionato
Subject: [Chicken-users] stressing the new hygienic macros
Date: Tue, 28 Apr 2009 18:05:16 +0200

I have subscribed again the list after a few years of absence, because I wanted
to try the new and improved hygienic Chicken ;-)
As first experiment, I tried to stress a bit syntax-rules. I tried the following
at the REPL:

> (define-syntax very-static-table
  (syntax-rules ()
    ((_ (name value) ...)
      (syntax-rules (<names> name ...)
        ((_ <names>) '(name ...))
        ((_ name) value) ...))))

 > (define-syntax color
  (very-static-table (red 0) (green 1) (blue 2)))

Error: unbound variable: red

        Call history:

        <syntax>                (define-syntax color (very-static-table (red 0) 
(green 1) (blue 2)))
        <syntax>                (very-static-table (red 0) (green 1) (blue 2))
        <syntax>                (red 0)
        <syntax>                (green 1)
        <syntax>                (blue 2)
        <eval>          (very-static-table (red 0) (green 1) (blue 2))
        <eval>          (red 0) <--

What's happening here? Notice that

 (define-syntax color
  (syntax-rules (<names> red green blue)
    ((_ <names>) '(red green blue))
    ((_ red) 0)
    ((_ green) 1)
    ((_ blue) 2)))

works as intended.




reply via email to

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