[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] auxiliary syntax
Just now, Alex Shinn wrote:
> I'm not proposing an unhygienic macro, but rather a macro that can
> match identifiers by their unhygienic symbol name (e.g. via
> syntactic-closure-expr or syntax->datum).
Yes, that's what I guessed on your behalf.
> This will never break.
Obviously this depends on what you define as "break". My expectation
(let ([+ whatever])
in "stuff" appearances of a `+' identifier has whatever meaning I give
it. Your definition of not breaking depends on me giving up that
expectation. IMO it's bad, and IME it's rarely useful.
> It's equivalent to writing a macro which can parse and optimize
> literal PCRE regex strings,
Absolutely, but that doesn't bother me because with the above `let' I
don't expect whatever to affect the meaning of a "foo+bar" string.
> it just happens to be using sexps, and is therefore tempting to
> write portably with syntax-rules.
What's the point of using sexprs then? You could have, just for the
sake of the argument, satisfy my expectation by requiring your macro
to be used as
(foo "(blah blah) blah")
(foo (blah blah) blah)
Yes, it's slight more work to implement, but that can be put into some
different `syntax-rules/string'; it's slightly more stuff to write,
but I *want* that to avoid ambiguity; and it's a problem with editor
support, but that's easy to fix (and a result of the fact that your
macros are no longer limited to plain sexprs).
But I'll answer that question. The point of using sexprs all the way
down is that you want to mix Scheme code inside the macro that
implements your DSL -- exacly as you do with your regexp-case thing.
That's exactly why macros are a good idea -- they're not just a way to
define a new DSL (that's something that is becoming very popular these
days, in all languages) -- they're a way to extend the language and be
able to mix it with existing code and with other extensions.
Composability and all that.
And if that's the point, then you can see how my expectation is
inherently broken again. I need to know that in some places in a
`foo' form `+' means what I think it means, and in other places it
really means "+".
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!
Scheme-reports mailing list