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...
[ Parent
| on HN ]
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
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.
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...This really is the sensible solution.