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

ShadoLight ettienne.gilbert at gmail.com
Mon Apr 8 14:47:22 UTC 2019


On Monday, 8 April 2019 at 13:31:24 UTC, Yuxuan Shui wrote:
> On Monday, 8 April 2019 at 13:11:51 UTC, ShadoLight wrote:
>> On Monday, 8 April 2019 at 12:01:39 UTC, Yuxuan Shui wrote:
>>
>> [..]
>>
>>
>>>> The compiler will directly reject...
>>>>
>>>> void fun(int a, int b) {...}
>>>> void fun(int c, int d) {...}
>>>>
>>>> ...  before you even try to call 'fun'.
>>>
>>> Contrary to popular belief, it won't.
>>>
>>> https://d.godbolt.org/z/Bmc-Qb
>>
>>
>> In line with popular belief it will. Try calling 1 of the 2 
>> functions i.e.:
>>
>> int x = fun(3,4);
>>
>> You have to call one of them for the compiler to be (un)able 
>> to resolve the call.
>
> Yes. But the post I was replying to says: "The compiler will 
> directly reject...  before you even try to call 'fun'.", which 
> is not true.

Yes, I agree he could have stated that better. But I'm pretty 
sure he meant something like "the compiler will directly 
reject... _once_ you even try to call 'fun'" or similar.

BTW, this is the same in C++.




More information about the Digitalmars-d mailing list