From: Lynn Winebarger <owinebar@free-expression.org>
Subject: syntax-case
Date: Mon, 19 Aug 2002 09:57:36 -0500 [thread overview]
Message-ID: <02081909573609.19624@locke.free-expression.org> (raw)
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
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next reply other threads:[~2002-08-19 14:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-19 14:57 Lynn Winebarger [this message]
2002-08-19 15:22 ` syntax-case Lynn Winebarger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=02081909573609.19624@locke.free-expression.org \
--to=owinebar@free-expression.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).