$result = 8 - 4 - 2;
the term 8 - 4 is a subexpression and the operand for the rightmost substraction operation; from that I deduce that associativity therefore defines the operand and subexpression evaluation order.
That might be a logical fallacy; which one, I wonder?
Anyways, that's how perl does it, although it is not defined in Perl. Of course the implementation could change, and perl could do a breadth-first evaluation of its execution tree and roll a dice for ad-hoc definition of evaluation order. But the optimizer would set things straight again, I guess :-)
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re^10: eval order of args to a sub
by shmem
in thread eval order of args to a sub
by otto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |