Stride
Jonathan M Davis
jmdavisProg at gmx.com
Mon Feb 13 12:52:38 PST 2012
On Monday, February 13, 2012 21:49:05 Artur Skawina wrote:
> "argument evaluation" in this context means that given eg "f(a,b,c);"
> it's not specified in what order the expressions 'a', 'b', and 'c'
> are evaluated, which matters if they are dependent or have side
> effects. (depending on arg passing conventions it can make sense to
> implement this one way or the other). If an expression is specced
> as l-t-r (as CatExpression is here) then the call to foo() must
> happen before executing bar(); the operator only comes into play later.
Ideally perhaps, but I expect that that's not true, because operator
overloading is done via lowering.
foo() ~ bar()
would become
opBinary!"~"(foo(), bar());
which is a normal function call. It's possible that the compiler always
evaluates foo first, but I'd seriously advise against relying on it.
In the long run, it probably will be guaranteed, because Walter wants to make
it so that function arguments are always evaluated left-to-right, but until
that happens, I wouldn't bet on foo() ~ bar() being guaranteed to have foo
called before bar, even it's supposed to be.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list