DIP 1030--Named Arguments--Community Review Round 1 Discussion

Steven Schveighoffer schveiguy at gmail.com
Thu Feb 6 21:37:11 UTC 2020


On 2/6/20 4:06 PM, Lim wrote:
> On Thursday, 6 February 2020 at 06:08:59 UTC, Mike Parker wrote:
>> This is the feedback thread for the first round of Community Review 
>> for DIP 1030, "Named Arguments"
> 
> How about template arguments? Can we still omit the parentheses if it is 
> one token long?
> 
> i.e., template Example(int a = 0, alias b, int c = 0) => Example!b:1

I think this is ambiguous:

template Example(int b)
{
    enum Example = b + 5;
}

enum b = 5;
auto x = true ? Example!b:1;

or maybe:

case Example!b:

It could be worked out if one examines the whole expression/statement, 
but I think we're better off avoiding support for such things.

Note that existing templates don't allow operators when omitting 
parentheses.

-Steve


More information about the Digitalmars-d mailing list