Issue 14228 - Function argument evaluation spec is inconsistent
Summary: Function argument evaluation spec is inconsistent
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL: http://dlang.org/expression.html
Keywords: spec
Depends on:
Blocks:
 
Reported: 2015-02-26 22:32 UTC by briancschott
Modified: 2022-12-17 10:37 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description briancschott 2015-02-26 22:32:17 UTC
The specification at http://dlang.org/expression.html says these things:

"The following binary expressions are evaluated in an implementation-defined order: ... function arguments"

"The evaluation order of function arguments is defined to be left to right."

"Note that dmd currently does not comply with left to right evaluation of function arguments."

So, if I'm reading this correctly, the spec doesn't agree with itself, and what it says doesn't matter anyways because the compiler doesn't implement it?
Comment 1 Johannes Pfau 2015-02-26 22:58:15 UTC
A long standing issue. Function arguments should be LTR. Pull request is available, but blocked as it needs a final decision by Walter or Andrei for the evaluation order of (all kinds of) assign expressions.

Currently blocked PR:
https://github.com/D-Programming-Language/dmd/pull/4035

History/Reference:

http://bugzilla.gdcproject.org/show_bug.cgi?id=8

http://forum.dlang.org/thread/bniaxycuguviwfdtojzf@forum.dlang.org

https://github.com/D-Programming-Language/dlang.org/pull/6
https://github.com/D-Programming-Language/dlang.org/pull/669
https://github.com/D-Programming-Language/dmd/pull/4035

https://issues.dlang.org/show_bug.cgi?id=6620


BTW: The spec doesn't really contradict itself:

"_are_ evaluated in an implementation-defined order: ... function arguments""
is what _does_ happen.

"The evaluation order of function arguments is _defined_ to be left to right."
is what _should_ happen.

"Note that dmd currently does not comply with left to right evaluation of function arguments."
explains the difference.