[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
syntax-case
From: |
Lynn Winebarger |
Subject: |
syntax-case |
Date: |
Mon, 19 Aug 2002 09:57:36 -0500 |
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
> (define x 5)
> (define-syntax foo
(lambda (exp)
(syntax-case exp ()
((_ y) (with-syntax ((z (datum->syntax-object (syntax _) x)))
(syntax (quote (z y))))))))
> (foo 8)
(5 8)
> (let ((x 8))
(let-syntax ((foo (lambda (exp)
(syntax-case exp ()
((_ y) (with-syntax ((z (datum->syntax-object (syntax
_) x)))
(syntax (quote (z y)))))))))
(foo 'bar)))
Error: identifier out of context x.
Type (debug) to enter the debugger.
>
I thought maybe the foo got expanded and _then_ the marked up x was not
recognized in the environment, so I tried this:
> (define tmp
(call/cc
(lambda (k)
(let-syntax ((foo (lambda (exp)
(syntax-case exp ()
((_ x ...) (k (syntax _)))))))
(foo 'h)))))
Error: identifier out of context k.
Type (debug) to enter the debugger.
So, apparently let-syntax is allowed access only to global variables
(and other syntax), though bindings from let(rec) do shadow syntactic
keywords.
Lynn
- syntax-case,
Lynn Winebarger <=