News for hackers. Stuff that matters.
Re:Put Your Commas On the Left Dink-Butt by shawndumas on Monday June 03, 2013 @07:54AM (#5812667)
or use a language/environment that allows for trailing commas...
Re:Put Your Commas On the Left Dink-Butt by jumblesale on Monday June 03, 2013 @07:59AM (#5812686)
Seriously! Every language should support this. Not just for arrays but in argument lists too! Python does a good job here but I can't think of anything else which does.
Re:Put Your Commas On the Left Dink-Butt by GotAnyMegadeth on Monday June 03, 2013 @08:12AM (#5812739)
Perl does
Re:Put Your Commas On the Left Dink-Butt by dspillett on Monday June 03, 2013 @08:24AM (#5812779)
Depending on other syntax facets, that can create ambiguity.

Does that trailing comma represent nothing (the end of the list) or an undefined/null/empty/whatever item (an extra item adding to the length of the list?

Even if the meaning is completely unambiguous as far as the language is concerned, that doesn't necessarily make it intuitive to humans especially in a mixed language scenario.

Re:Put Your Commas On the Left Dink-Butt by jbert on Monday June 03, 2013 @10:24AM (#5813424)
perl allows both trailing commas and also optional list-quoting which breaks on whitespace (commas unneeded):

    my @stuff = (
      "foo",
      "bar",
      "baz",
    );
or:

    my @stuff = qw(
      foo
      bar
      baz
    );
or

  my @stuff = qw(foo bar baz);
TIMTOWDI indeed...
Re:Put Your Commas On the Left Dink-Butt by cs648 on Monday June 03, 2013 @07:55AM (#5812674)
This really is the sensible solution.
Re:Put Your Commas On the Left Dink-Butt by Narretz on Monday June 03, 2013 @08:06AM (#5812714)
Hint hint: PHP does this!