[erlang-questions] comma-less lists and tuples

Vlad Dumitrescu <>
Wed Sep 20 20:02:26 CEST 2006


Hi,

On 9/20/06, Yariv Sadan <> wrote:
> When working with ErlSQL, I came to the opinion that in some cases,
> Erlang would benefit from allowing whitespace as a delimiter in lists
> and tuples in place of commas. Consider this small example:
>
> {select, [foo, bar, baz], {from, [table1, table2]}, {where, {xyz, '=',
> {'+', [1,2,3,4]}}}}
>
> If commas were optional, this example could be written as
>
> {select [foo, bar, baz] {from [table1, table2]} {where {xyz '=' {'+'
> [1 2 3 4]}}}}
>
> I think the second line is more readable, and it's also easier to
> write. In other DSELs, the difference may be even more substantial.

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...

Better to use a syntax that's matching the DSL and write a parser for
it, I think.

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.

Just my 2c.

regards,
Vlad



More information about the erlang-questions mailing list