DIP 1019--Named Arguments Lite--Community Review Round 1

Paul Backus snarwin at gmail.com
Sun Feb 17 18:56:28 UTC 2019


On Sunday, 17 February 2019 at 18:23:13 UTC, Elronnd wrote:
> I might be misunderstanding something, but with this code:
>
> int add(int x, int y);
> @named:
> int add(int c, int d);
>
> What happens if I do add(5, 6)?  Won't that be ambiguous?

All declarations with the same signature must refer to the same 
function. Or, in other words, only one of them can have a 
function body, and that body will be used for all calls that 
match any of the equivalent declarations.

Redundant declarations like this are actually already allowed in 
D; there just isn't any particular reason you'd want to use them. 
Example: https://run.dlang.io/is/MSmiF5


More information about the Digitalmars-d mailing list