The trailing-comma feature is one of the (relatively few) things I really like about Python, and I'd be happy to see it added to Chapel. In particular, when debugging, I sometimes like to be able to have a list of complex objects, with a comma at the end of each line, and a final ")" on a line by itself. I can then "comment out" various elements without having to worry about having commented out the last element and thus needing to remove a trailing "," on the most recent non-comment line.

So, if anyone is counting responses for or against, count me as "for" this.

Dave W

On 09/06/2016 01:55 PM, Russel Winder wrote:
I raised this point elsewhere and it was suggested I bring it here with
a view to there being a change in the Chapel parser.

Some language treat a trailing comma in a list or tuple literal as not
a problem. Many language, including currently Chapel, treat this as an
error. For many this is a trivial non-issue. For some, people who
construct tables of data for things like tests or application
configuration, it becomes a real irritant.

As with other language that have tuple literals Chapel requires a
trailing comma in a tuple literal of one element:

(1,)

completely understandable, indeed required. However Chapel as many
other language does not allow a trailing literal in any other
situation: so

(1, 2,)

would be an error. This is a trivial point in many ways, but leads to
huge irritations. If only this were allowed many hors of pain and
anguish would be averted. Witness Python and other languages that allow
the redundant trailing comma:

[]
[1], [1,]
[1, 2], [1, 2,]

()
(1,)
(1, 2), (1, 2,)

are all legal in language allowing trailing redundant comma. In
languages that do not allow this, literal data manipulation become a
right royal pain in the proverbials.

Personally I see no reason at all for not allowing this element of
redundancy. I believe the Chapel grammar should be amended to allow
this.



------------------------------------------------------------------------------


_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

------------------------------------------------------------------------------
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to