[erlang-questions] comma-less lists and tuples

Thomas Lindgren thomasl_erlang@REDACTED
Wed Sep 20 17:47:21 CEST 2006


(Sorry about top-posting, I'm trying out Yahoo's new email.)


Smalltalk has a similar notation, something like "select: [foo bar baz] from: [tab1, tab2] where: [xyz '=' {'+', [1 2 3 4]}]"'

which would invoke (in Erlang syntax):

'select:from:where'(A1, A2, A3) -> ...

I thought that was a pretty neat idea, but I'm not sure how to integrate it with Erlang. However, to get back to the actual proposal: in Erlang as we know it, the  comma-less notation is ambiguous, e.g.

{X andalso Y} = {(X andalso Y)} or {X, 'andalso', Y}?

So that would have to be fixed first. Anyway, those who are interested could have a go at erl_parse.yrl and see whether it can be done.

Best,
Thomas

----- Original Message ----
From: Yariv Sadan <yarivvv@REDACTED>
To: erlang-questions <erlang-questions@REDACTED>
Sent: Wednesday, September 20, 2006 4:17:30 PM
Subject: [erlang-questions] comma-less lists and tuples

Hi,

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.

What do you think? Am I missing something?

Best regards,
Yariv
_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://www.erlang.org/mailman/listinfo/erlang-questions






More information about the erlang-questions mailing list