chapel-lang/chapel — pull request #121 by vasslitvinov (2014-08-07 15:06:52+00:00)
Title: Do not create order wrappers during resolution.

Do not create order wrappers during resolution.
Instead, when needed, reorder the call actuals directly.

Order wrappers are mentioned in svn:r1358 - see ACallbacks::order_wrapper(),
and were introduced before that. We no longer know why we were not
reordering the actuals directly back then.

As to the order of any side effects that may happen while evaluating
the actuals: I believe that any side effects are flattened during
normalization into statements that preceed the CallExpr. The actuals,
I expect, are all just symbols, so it does not matter what order to
pass them in.

I will add separately a test that highlights the evaluation order.
Its output differs from what would be produced by the rule "evaluate
the actuals in the order they appear in the call". However, the spec
does not seem to define the order of evaluating the actuals, and the
output of the test is unaffected by this change.

IMPLEMENTATION NOTES

This turned out to be a simple change.

I renamed the function and made it return void, to make it clear
that it will never create a wrapper. I left its definition and
its call in the spots where they have been, partly to preserve
history, partly because I did not see any better spots for them.