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

Steven Schveighoffer schveiguy at gmail.com
Thu Feb 6 15:30:40 UTC 2020


On 2/6/20 4:39 AM, Andrea Fontana wrote:
> 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":
> 
> What about UFSC + named arguments?

Responding to this and the one in the feedback thread.

My understanding is that UFCS works like this:

a.foo(...);

translates to:

foo(a, ...);

So if you follow that logic, the rules apply after that translation as 
if you called the function that way.

example:

void doStuff(int a, string b, double c) {}

3.doStuff(6.7, b: "ham") => doStuff(3, 6.7, b: ham) => error, no match 
(6.7 doesn't match type to b)

3.doStuff(c: 6.7, b: "ham") => doStuff(3, c: 6.7, b: ham) => OK, all 
parameters match

3.doStuff(a: 5, "ham", 6.7) => doStuff(3, a: 5, "ham", 6.7) => error, 
cannot match a twice

Might be a good point to add UFCS discussion to the DIP.

-Steve


More information about the Digitalmars-d mailing list