DIP 1020--Named Parameters--Community Review Round 2

Paul Backus snarwin at gmail.com
Tue Sep 10 21:54:35 UTC 2019


On Tuesday, 10 September 2019 at 20:33:01 UTC, jmh530 wrote:
> On Tuesday, 10 September 2019 at 20:08:38 UTC, jmh530 wrote:
>> [snip]
>
> I also don't understand this
>
> void foo(int a) {
> }
>
> void foo(int a, @named int b) {
> }
>
> [snip]
>
> foo(1); // error: matches both declarations
> foo(1, b: 2); // error: matches both declarations

The idea is that named arguments and named parameters are ignored 
*completely* when resolving overloads--only the positional 
arguments are used. So it's as if you'd written:

void foo(int a) {
}

void foo(int a) {
}

foo(1);
foo(1);


More information about the Digitalmars-d mailing list