Steven Schveighoffer <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #2 from Steven Schveighoffer <> 2011-03-18 
13:17:57 PDT ---
That's true for arguments to a single function.  But what about arguments to
different functions in the same expression?  Considering that you MUST call the
functions in left-to-right order given because the next function in the chain
depends on the result of the previous.

I'm not saying the current behavior is wrong or not expected, but it feels
weird when one parameter is evaluated left to right (the struct reference) and
the other parameter is evaluated right to left *across the expression*.

For example, if I do:


it prints

I would expect what Fawzi did.  It would be nice to get an explanation of why
it works this way, if it is intentional.

What would you expect for this:

size_t inc(ref size_t i) { return ++i; }


would you expect it to first run both incs, caching the return values and then
using that to call a?  Because that's what it does.

Also, this is weird too:

struct A
  A opCall(ref size_t i)
    printf("i=%d\n", i);




If I change i to a large struct, then the prospect of pushing multiple copies
of that large struct on the stack so I can cache the results becomes alarming.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to