Heya Mark, On Fri 20 Jan 2012 23:03, Mark H Weaver <m...@netris.org> writes:
> (let ((x 1)) > (syntax-local-binding #'x)) > > is not equivalent to: > > (let ((x 1)) > (local-eval '(syntax-local-binding #'x) (the-environment))) Indeed; bummer! I think, though, that this is simply a consequence of giving more power to macro writers. It is analogous in some ways to the changes that identifier-syntax introduce into macro writing: with identifier-syntax, one can no longer write a code walker with syntax-rules pattern matching, as single identifiers may expand out to complicated expressions, possibly even with side effects. >> Why do you think that? The procedures do carry metadata; I understood >> that that was your strategy, to use the serialization of the >> syntax-rules form in the procedure metadata. > > Well, this was in the context of a new strategy where psyntax would > include a new core form called `call-with-current-local-expander' that > calls its parameter (a procedure or macro) with a procedure that accepts > an expression and returns an expanded form. In this case, the most > straightforward implementation would simply serialize the (r w mod) > structures directly. > > Toward that end, I was thinking it would be nice to keep those > structures serializable. The only part that's not currently > serializable are the transformer procedures for local macros. > Thus the change in representation. I have been staring at this empty page here for a little while, writing and re-writing, but I can't get over a feeling that I really don't want this kind of work in psyntax itself. Who knows, maybe you have really convincing arguments here, but this particular argument should not be driving a decision about e.g. including syntax-local-binding or not. That sounds negative, and in a way of course it is -- but still, I'd much rather enable people to make powerful syntactic abstractions like local-eval outside psyntax. Syntax-parse, for example, if it ever lands, will land in the form of a module In this case there are lots of strategies you could use. We could change psyntax to embed the syntax objects in the procedure meta-data, like I said. Ice-9 local-eval could #:replace its own syntax-rules. We could (and probably should) do procedure serialization. Regards, Andy -- http://wingolog.org/