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

Lim himeix at outlook.com
Thu Feb 6 21:41:33 UTC 2020


On Thursday, 6 February 2020 at 21:06:38 UTC, Lim wrote:
> Can we still omit the parentheses if it is one token long?

And another example of this issue:

template Example(alias x, int y = 0) { ... }

// assume x defined before

is(Example!x : int) { ... }

Note: Although DIP 88 and DIP 1020 give some examples on using 
Named Arguments with single parameter template (all with 
parentheses). Nothing is mentioned on whether parentheses are 
required in this situation.

According to current Spec: "If the TemplateArgument is one token 
long, the parentheses can be omitted", all two examples I showed 
are legal. As the indentifier tokens are not the same thing as 
TemplateArgument tokens:

+TemplateNamedArgument:
+    Identifier : TemplateArgument
+    TemplateArgument

Thus, the single-token parameter use case should be regulated in 
DIP 1030.


More information about the Digitalmars-d mailing list