[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] stressing the new hygienic macros
From: |
Alex Shinn |
Subject: |
Re: [Chicken-users] stressing the new hygienic macros |
Date: |
Wed, 29 Apr 2009 02:08:43 +0900 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.3 (darwin) |
Michele Simionato <address@hidden> writes:
> 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
This is left unspecified by R5RS which says nothing about
transformer specs other than syntax-rules. Chicken 4
extends define-syntax with the er-macro-transformer spec,
(and with raw lambdas which mean the same thing), but these
are hard-coded.
Al* Petrofsky specifically argued that this be allowed, as
well as
(let-syntax ((foo some-other-macro))
...)
and implemented it in his alexpander. It's a necessary
feature for the user to provide his/her own syntax
transformers defined in terms of existing transformers
(e.g. super-syntax-rules with extended pattern matching).
The other syntactic-closures and riaxpander macros systems
in Chicken 3 also support it, as do MIT Scheme, Ikarus and
Chibi-Scheme. PLT doesn't. A lot of interpreters do, but
more by coincidence than design, and the fact that they
represent macros as first-class values (which would make
separate compilation, even to bytecode, much harder).
--
Alex