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

Patrick Schluter Patrick.Schluter at bbox.fr
Mon Jun 10 18:28:38 UTC 2019


On Sunday, 9 June 2019 at 21:01:35 UTC, Jonathan Marler wrote:
> On Sunday, 9 June 2019 at 19:43:54 UTC, Andrei Alexandrescu 
> wrote:
>> On 6/9/19 7:27 AM, aliak wrote:
>>> With reorderable, as Walter pointed out, what't the order 
>>> (parameter-wise or argument-wise).
>>
>> Lexical order of course.
>
> Lexical order of the definition or the caller?
>
> So far we have 1 for the caller and 1 for the definition. Both 
> seem to think their choice is the obviously correct one :)
>
>   > Patrick Schluter:
>   > They are in the order of declaration of the 
> function...There's no reason to evaluate it any other order as 
> the code generation requires that the caller populates the 
> registers/stack in the order the function expects.
>
>   > Paul Backus:
>   > Personally, I think the obviously-correct choice is to 
> evaluate them in lexical order (i.e., order of the call).

That's probably a bottom up vs top down perception of things. 
When you learned the stuff at the assembly/object level you tend 
to see the things in cpu perspective, and there you tend to see 
the call convention for what it is pushing register in a specific 
order.
If you came from the high level application level where the 
machine implementation is nothing more than a detail, you tend to 
don't care about the hoops the compiler/implementation has to go 
through to realize the abstraction the language presents (best 
example is the set types in Pascal where the elegance of 'if c in 
[a..z]' was loved by programmers, but resulted in an incredibly 
complex code).

This said, the lexical order is after all the more abstract one 
and the complexity of it is imo manageable by the compiler so 
there's nothing that should preclude it, even if in my mental 
model that is closer to the implementation, would see callee 
order first.



More information about the Digitalmars-d mailing list