No subject


Sat Oct 4 17:15:07 PDT 2008


> 
> > I'm not sure but I think this might be intended in any place that accepts a
> > comma separated list to make it easier to maintain long multi-line lists. For
> > example, copy/pasting a bunch of entries from the start/middle of a list to the
> > end and you don't have to worry about adding a comma after the former last
> > element or removing the comma from the new last element. That's been my
> > assumption, as I've actually found it useful for just that reason.
> 
> Is it documented anywhere?

For enums, and array and struct initializations: yes. For parameter and
argument lists: not according to the grammars, however the inconsistency makes
me wonder if (and hope) the "not allowed" ones were oversights.

The following appear to be the same in both D1 docs and D2 docs:

http://www.digitalmars.com/d/1.0/enum.html

EnumMembers:
        EnumMember
        EnumMember ,
        EnumMember , EnumMembers

http://www.digitalmars.com/d/1.0/declaration.html

ArrayMemberInitializations:
        ArrayMemberInitialization
        ArrayMemberInitialization ,
        ArrayMemberInitialization , ArrayMemberInitializations

StructMemberInitializers:
        StructMemberInitializer
        StructMemberInitializer ,
        StructMemberInitializer , StructMemberInitializers

ParameterList:
        Parameter
        Parameter , ParameterList
        Parameter ...
        ...

DeclaratorIdentifierList:
        DeclaratorIdentifier
        DeclaratorIdentifier , DeclaratorIdentifierList

http://www.digitalmars.com/d/1.0/template.html

TemplateParameterList
        TemplateParameter
        TemplateParameter , TemplateParameterList

TemplateArgumentList:
        TemplateArgument
        TemplateArgument , TemplateArgumentList

http://www.digitalmars.com/d/1.0/expression.html

NewExpression:
        NewArguments Type [ AssignExpression ]
        NewArguments Type ( ArgumentList )
        NewArguments Type
        NewArguments ClassArguments BaseClasslistopt { DeclDefs } 

NewArguments:
        new ( ArgumentList )
        new ( )
        new

ClassArguments:
        class ( ArgumentList )
        class ( )
        class

ArrayLiteral:
        [ ArgumentList ]

IndexExpression:
        PostfixExpression [ ArgumentList ]

PostfixExpression:
        PrimaryExpression
        PostfixExpression . Identifier
        PostfixExpression . NewExpression
        PostfixExpression ++
        PostfixExpression --
        PostfixExpression ( )
        PostfixExpression ( ArgumentList )
        IndexExpression
        SliceExpression

ArgumentList:
        AssignExpression
        AssignExpression , ArgumentList


-- 



More information about the Digitalmars-d-bugs mailing list