Hi,
On Tue 15 Jun 2010 11:53, Tentaclius <[email protected]> writes:
> (define-syntax test
> (syntax-rules ()
> ((test)
> (lambda args
> (match args
Guile's match implementation implemented using define-macro, so it is
not hygienic. `args' is produced by the expansion of a hygienic macro,
so the expansion of `match' can't see it.
>From NEWS:
** Lexical bindings introduced by hygienic macros may not be referenced
by nonhygienic macros.
If a lexical binding is introduced by a hygienic macro, it may not be
referenced by a nonhygienic macro. For example, this works:
(let ()
(define-macro (bind-x val body)
`(let ((x ,val)) ,body))
(define-macro (ref x)
x)
(bind-x 10 (ref x)))
But this does not:
(let ()
(define-syntax bind-x
(syntax-rules ()
((_ val body) (let ((x val)) body))))
(define-macro (ref x)
x)
(bind-x 10 (ref x)))
It is not normal to run into this situation with existing code. However,
as code is ported over from defmacros to syntax-case, it is possible to
run into situations like this. In the future, Guile will probably port
its `while' macro to syntax-case, which makes this issue one to know
about.
In short: use something other than `match', or contribute a hygienic
implementation of `match' :)
Cheers,
Andy
--
http://wingolog.org/