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

Arine arine123445128843 at gmail.com
Tue Feb 11 13:34:28 UTC 2020


On Monday, 10 February 2020 at 06:02:02 UTC, Walter Bright wrote:
> On 2/8/2020 9:09 PM, Arine wrote:
>> In the D spec it's stated arguments are evaluated from left to 
>> right. I know DMD doesn't follow the spec (but LDC2 does). It 
>> needs to be outlined how arguments are evaluated. What makes 
>> sense at the call site, or based on the function order. As 
>> arguments can be passed out of order now.
>> 
>>      __gshared int i = 0;
>>      void foo(int a = ++i, int b = ++i, int c = ++i, int d = 
>> ++i, int e = ++i) {
>>          writeln(a, " ", b, " ", c, " ", d, " ", e);
>>      }
>> 
>> 
>>      foo(d: ++i, b: ++i); // what does this print?
>
> It says in the DIP that arguments are evaluated left to right 
> as presented.

"as presented"


Where is a, c, and e "presented" here? Or are you saying they 
just are never evaluated as they aren't present? You need more 
than a single sentence in the DIP to describe the behavior.

     foo(d: ++i, b: ++i);


>> How does this work with forward declaring?
>
> D doesn't have forward declarations.

It does. Your just arguing semantics instead of addressing the 
problem.

module a;

extern(C) void foo() { }


module b;

extern(C) void foo();

void boo() {
     foo(); // calls a.foo();
}




More information about the Digitalmars-d mailing list