[plt-scheme] local syntax-case macro does not see earlier macro
The right hand side of your `syntax-case' macro should look like this:
#'(foo)
The RHS of `syntax-case' clauses is an expression, not a template.
You need the explicit `syntax' or #' to get a template.
sam th
On Fri, May 22, 2009 at 11:09 AM, Marijn Schouten (hkBst)
<hkBst at gentoo.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> The following works fine:
>
>
> ==============
> $ cat test.scm
> (define-syntax foo (syntax-rules () ((_) "It works!")))
>
> (define (f) (let-syntax ((bar (syntax-rules () ((_) (foo)) ) )) (bar) ) )
>
> #;(define (f)
> (let-syntax ((bar (lambda (x) (syntax-case x () ((_) (foo)) ) ) )) (bar) ) )
>
> (display (f)) (newline)
> ==============
> $ mzscheme -e '(require scheme)' -f test.scm
> It works!
> ==============
>
>
> But if you choose to use instead the equivalent commented definition of f, you get:
>
>
> ==============
> $ mzscheme -e '(require scheme)' -f test.scm
> reference to undefined identifier: foo
>
> === context ===
> test.scm:8:20
> ==============
>
>
> Why is this so?
>
> Marijn
>
> - --
> If you cannot read my mind, then listen to what I say.
>
> Marijn Schouten (hkBst), Gentoo Lisp project, Gentoo ML
> <http://www.gentoo.org/proj/en/lisp/>, #gentoo-{lisp,ml} on FreeNode
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkoWwA4ACgkQp/VmCx0OL2wEOwCfek/+uvvsn8l2Ct6HFM6ejpo5
> PJMAn26C8YAlcKTpNt3P3hJ8ep2R3Bh1
> =PNMn
> -----END PGP SIGNATURE-----
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
--
sam th
samth at ccs.neu.edu