Order of evaluation for named arguments
Timon Gehr
timon.gehr at gmx.ch
Thu Apr 3 20:31:08 UTC 2025
On 4/3/25 21:26, Dennis wrote:
> On Thursday, 3 April 2025 at 18:48:49 UTC, Timon Gehr wrote:
>> This is simply about a commitment that had been made on the newsgroup
>> _to change any the existing behavior deviating from left-to-right_
>> that has had only partial follow-through so far,
>> and is now being walked back in the spec instead of just a simple: "we
>> have not done it yet because it did not seem important enough and we
>> prioritized other things".
>
> I wasn't aware of that commitment, have any implementation changes been
> made since that? And do you have a link to the newsgroup thread?
>
I only found these so far, unfortunately these do not seem as conclusive
as I remember (because they usually talk specifically about "functions"
and I suspect some functions are considered to be more function-like
than other functions):
TDPL, says function arguments are evaluated left-to-right on page 50.
https://forum.dlang.org/thread/f0pvsn$1pju$1@digitalmars.com
https://github.com/dlang/dlang.org/pull/6
https://lists.puremagic.com/pipermail/digitalmars-d/2011-December/118189.html
https://forum.dlang.org/thread/ylgtwzvqnupnehipxayk@forum.dlang.org
https://forum.dlang.org/thread/vbpjyhxtjmtebnjmidyf@forum.dlang.org
AFAIU both my frontend and SDC went with strict source-order evaluation.
That seems like the only sensible generalization of left-to-right
function argument evaluation, but perhaps common sense is not so common
after all.
More information about the Digitalmars-d
mailing list