Order of evaluation for named arguments
claptrap
clap at trap.com
Tue Apr 1 22:00:47 UTC 2025
On Tuesday, 1 April 2025 at 19:00:49 UTC, Walter Bright wrote:
> On 3/30/2025 6:21 PM, Jonathan M Davis wrote:
>> It might, but most folks don't even realize that named
>> arguments are a thing
>> in D, and most code doesn't rely on the order of evaluation of
>> the arguments
>> to a function. As such, I would expect that the amount of code
>> that would
>> actually break would be extremely small (and possibly zero).
>>
>> Most bug fixes risk silently breaking some piece of code that
>> accidentally
>> relied on the broken behavior, and I think this is a case
>> where the odds of
>> it actually causing problems are sufficiently low that it's
>> worth just
>> making it all consistent - and the sooner we do it, the less
>> likely it is to
>> break any code.
>
> It's a good argument, but we really have no idea how much code
> depends on named arguments. I'm also really tired of the
> vitriol we get when breaking existing code.
Will it be more or less vitriol than what you get from all the
people who expect the arguments to be evaluated left to right? I
mean there seems to be a pretty solid consensus that is what is
expected. This fails pretty bad on the principle of least
surprise right?
And as it is now you have to look up the definition of the
function to understand what order the arguments are evaluated.
You cant know just by looking at the call code, you need to look
at the function definition.
It's unnecessary cognitive load, and unintuitive. And you will
probably have to listen to people complain about it for years to
come, just like the "strict private" crap.
You want to have years and years of flame wars over argument
evaluation order?
Make the hard but correct decision.
More information about the Digitalmars-d
mailing list