The Ada 2012 standard says:
For the execution of an assignment_statement, the variable_name and the expression are first evaluated in an arbitrary order.
I am wondering how far reaching that statement is. If both the right hand side and the left hand side of an assignment contains subprogram calls, can those calls be made in arbitrary order, or will all the left hand side be evaluated before/after all the calls of the right hand side?
E.g. if I have Arr(L1(X), L2(X)) := Arr(R1(Y), R2(Y)), can I be sure that the call order will be one of:
- L1, L2, R1, R2
- L1, L2, R2, R1
- L2, L1, R1, R2
- L2, L1, R2, R1
- R1, R2, L1, L2
- R1, R2, L2, L1
- R2, R1, L1, L2
- R2, R1, L2, L1
Or could the calls on the left hand side and the right hand side be mixed, such as: L1, R2, L2, R2?
My interpretation of the reading is that it wouldn't mix them and instead use one of your 8 options above. However, I couldn't find any specific wording to confirm or deny that. If no one else is able to answer definitively, I would recommend creating an issue at the Ada Rapporteur Group github and seek clarification on the ARM wording. You might be able to get a more definitive answer there
https://github.com/Ada-Rapporteur-Group/User-Community-Input/issues