[Issue 2477] Trailing comma in array literal sometimes accepted, sometimes not
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 30 17:38:37 PST 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2477
------- Comment #2 from wbaxter at gmail.com 2008-11-30 19:38 -------
Thanks for the spec digging, Stewart. So I see three options:
1) change the ArrayMemberInitializations production to:
ArrayMemberInitializations:
ArrayMemberInitialization
ArrayMemberInitialization , ArrayMemberInitializations
(get rid of the trailing comma case for initializations)
2) change the ArrayLiteral productions to
ArrayLiteral:
[ ArrayLiteralMemberList ]
ArrayLiteralMemberList:
AssignExpression
AssignExpression ,
AssignExpression , ArrayLiteralMemberList
3) Just make all argument lists have an optional trailing comma. This is based
on the thinking that if allowing a trailing comma is a nice feature for arrays,
then why not general argument lists (which can be used as general array
constructors with typesafe variadic A[]... style parameters.)?
ArgumentList:
AssignExpression
AssignExpression ,
AssignExpression , ArgumentList
I vote for #2.
--
More information about the Digitalmars-d-bugs
mailing list