[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] auxiliary syntax

On Sat, Jan 12, 2013 at 12:06 AM, Eli Barzilay <eli@x> wrote:
Just now, Alex Shinn wrote:

> 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.
[... general discussion of why strings are superior to sexps ...]

I never thought I'd have to explain this on a Scheme or Lisp
related list, but the advantages of sexps are:

  1. You don't need a parser.
      - Faster development time for new DSLs because you're
        not writing a parser.
      - Smaller executable size (the PCRE parser is by far the
        largest part of irregex).
      - Faster - parsing moved from runtime to compile time
      - Safer - no parse errors at runtime
  2. Easier to learn
      - Programmers don't have to learn a whole new parser
        syntax, they just learn the names and semantics.
  3. Easier to handle with existing Scheme tools.
      - Notably syntax-rules _can_ walk this statically if the
        bindings are the same.

Sexps are hands-down superior.  Personally I have no
trouble remembering that within the SRE syntax the bindings
never change - actually it would be impossible to read if
the bindings changed, because there are so many and because
I don't think of it as Scheme to begin with.  You can still
have escapes (unquote) into Scheme code and preserve
hygiene there.


Scheme-reports mailing list