DIP 1030--Named Arguments--Community Review Round 1 Discussion
Lim
himeix at outlook.com
Thu Feb 6 21:06:38 UTC 2020
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
If the answer is yes, considering the following code:
template SomeTemplate(int a = 0, alias b, int c = 0)
{
alias SomeTemplate = b;
}
const b = 2;
const c = 3;
switch(someInt)
{
case 1: .. case SomeTemplate!b : c: writeln("we are in
case"); break;
default: writeln("we are in default"); goto c;
}
It's valid now and when someInt >= 3, "we are in default" and "we
are in case" will both be printed.
According to the rule "If an Identifier is present, it matches
the Parameter with the corresponding Identifier", when this DIP
come into power, this code won't compile as there is no
LabeledStatement Identifier named c.
Is this a potential compatibility issue? Or is there a
misunderstanding of my interpretation of the new DIP?
More information about the Digitalmars-d
mailing list