Order of evaluation for named arguments

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon Mar 31 19:47:01 UTC 2025


I've been thinking about this situation for a few days.

I recognize that changing the compiler may not be a simple task.

My conclusion about the specification is that an attempt was made to 
define D so that the order of evaluation is always as written left to 
right. See comma expression for a near identical evaluation definition.

Before named arguments were added, the arguments list and parameter list 
orders matched, so a poorly written description was accurate.

However with named arguments the distinction between a called function 
parameter list dictating the matched argument list order, and the order 
as written by the user argument list, became meaningful.

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.

Right now the order in which arguments are written do not contribute to 
evaluation ordering. Although I suspect that this is more of an 
oversight then what is intended.

Regardless the spec here needs some work done to make this clearer, 
because it is confusing the called functions definition against the 
arguments list.



More information about the Digitalmars-d mailing list