Trailing spaces in lists: bug or feature?

Timon Gehr timon.gehr at gmx.ch
Sun Jun 16 04:15:57 PDT 2013


On 06/16/2013 01:01 PM, monarch_dodra wrote:
> I've come to notice something which I *though* was nice, but I have not
> yet used it extensively, because I'm unsure it is a feature. I wasn't
> able to find an answer in the grammar.
>
> Basically, it would appear that in D, whenever you have a comma
> delimited list of things, you are allowed to append a comma after the
> last parameter. This can help when declaring lists, or auto generating
> code, so you don't have to "special case" the last item. The most basic
> example I can think of are enums:
>
> ...
> I *think* this is D feature, but I'd like confirmation.
>
> --------------------------------------
> I've *also* noticed this works for function calls and/or constructors
> (yes, I know, they are just functions). EG:
>...
> I'm even less sure that this is a feature... Well... Is it?

Feature. Eg. http://dlang.org/expression.html#ArgumentList :

ArgumentList:
     AssignExpression
     AssignExpression ,               // <- here
     AssignExpression , ArgumentList


More information about the Digitalmars-d mailing list