Order of evaluation for named arguments
Salih Dincer
salihdb at hotmail.com
Mon Mar 31 21:43:07 UTC 2025
On Monday, 31 March 2025 at 19:47:01 UTC, Richard (Rikki) Andrew
Cattermole wrote:
>
> It is my view that the order of evaluation should mirror that
> of the programmer, or at least be predictable. Named arguments
> entirely eliminate this predictability as a possibility as the
> order of evaluation could change over time or be in any
> position "unknown" to the user.
+1
If the probability is low, as Jonathan emphasizes, then please
change the behavior of the D compiler. Or if not, in this case,
here is the intermediate solution:
**Add a warning or error message**
"Named arguments are evaluated in parameter order, so be mindful
of side effects!"
If this behavior is intentional, it at least needs to be clearly
communicated. In summary, we cannot get away with changing the
specification. Because this is an unintuitive situation.
SDB at 79
More information about the Digitalmars-d
mailing list