Order of evaluation for named arguments
Jonathan M Davis
newsgroup.d at jmdavisprog.com
Thu Apr 3 17:19:08 UTC 2025
On Thursday, April 3, 2025 3:33:30 AM MDT Dennis via Digitalmars-d wrote:
> First of all, anyone who designs code to only work when the side
> effects in an argument list are executed in a particular order
> is, to put in Walter's terms, a 'no hire' for me. I'd consider
> the side effects to be unordered just like in C, and D's
> 'left-to-right' specification is simply a courtesy giving more
> consistent behavior across compilers.
Part of me thinks that we should have randomized the order of evalutation
with every run of the compiler just to shake out code that relies on it.
Having it be defined to be left-to-right certainly helps with consistency,
but I completely agree that code shouldn't be relying on it - if nothing
else, because it's a bad habit to get into given that there are other major
languages which don't follow it.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list