[erlang-questions] comma-less lists and tuples
Yariv Sadan
yarivvv@REDACTED
Wed Sep 20 20:22:38 CEST 2006
Hi Vlad,
>
> IMHO, this is a case for a real DSL - I mean, what's the point in
> contriving a DSL's syntax to follow Erlang's or extend Erlang syntax
> to match arbitrary DSLs? Maybe other DSLs will require lists delimited
> with {} and tuples with [], for example...
I don't think Erlang's syntax should be extended to match arbitrary
DSLs... however, I do think that allowing whitespace to be treated as
a delimiter (if it's possible and it wouldn't break any existing code)
would make the existing Erlang syntax, which is already quite friendly
for a variety of DSLs (of which ErlSQL is just one example), even more
DSL-friendly.
>
> Better to use a syntax that's matching the DSL and write a parser for
> it, I think.
That's an option, but then your build process becomes more cumbersome.
On the other hand, if you stay in Erlang, you are more limited by the
constraints of Erlang's syntax, but this is probably good enough for a
large number of DSLs. For the more advanced ones, a special parser may
be required.
>
> In this particuar case, I'd either go with full sql (it's at least
> standard, people already know it) or find an Erlang equivalent that
> isn't following sql that closely.
The main benefit of ErlSQL is that it makes programmatic generation of
queries in Erlang easy because you work with the semantic elements of
SQL directly in Erlang rather than doing string concatenation. The
examples I've shown have a make a literal translation to SQL, which
may not seem so impressive, but examples that involve more
programmatic SQL generation look far better with ErlSQL than with
string-concatenation.
Regards,
Yariv
More information about the erlang-questions
mailing list