[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: syntax-case
From: |
Lynn Winebarger |
Subject: |
Re: syntax-case |
Date: |
Mon, 19 Aug 2002 10:22:08 -0500 |
On Monday 19 August 2002 09:57, Lynn Winebarger wrote:
> Does anyone else see the following behaviour (from a Petite Chez
> session) as inconsistent?
> I was trying to figure out how you can eagerly expand macros without
> worrying about this sort of thing, and
this sort of thing means the dependence of a macro expansion on a
variable binding that could change. And apparently, plain lexical variable
bindings are not in scope in a let(rec)-syntax, but global variable bindings
are. The last email didn't include an example of the global binding working
in a let-syntax (just in define-syntax), so here's one (again from Chez):
> (define x 5)
> (let-syntax ((foo (lambda (exp)
(syntax-case exp ()
((_ y) (with-syntax ((z (datum->syntax-object (syntax
_) x)))
(syntax (quote (z y)))))))))
(foo 'bar))
(5 'bar)
>
I had thought this behaviour was part of syntax-case, but now I see it's
actually part
of let(rec)-syntax. If the lexical variables were in scope in a
let(rec)-syntax, macros
would have to be re-expanded every time an expression that contained them got
executed. I'm not sure why the same criticism doesn't hold for global variable
bindings,
though.
Lynn
- syntax-case, Lynn Winebarger, 2002/08/19
- Re: syntax-case,
Lynn Winebarger <=