Oh ok, right. I didn't intend to be that general. There are a few select places where execution order is defined. Your example of the RHS computing before the LHS isn't a good one because that part isn't well defined. That only matters where computing the LHS has some sort of external effect on a dependancy of the RHS. Of course, the RHS has to be executed before the assignment but the LHS also has to execute to find the lvalue for the assignment and its that part that can move around.
Anyhow, I think I'm clear on when I care about execution order - only when the sub-expressions in a statement depend on each other - say multiple shift statements: sub { ${ shift() } = shift }->( a, b ). In this case sassign wants the LHS as its last argument so the second shift runs first then the first shift and scalar dereference. Execution order matters here because a common element is being altered. Ah well.
perl -MO=Concise -e '@ARGV=qw(a b); ${shift()} = shift;' | Idealized optrees from B::Concise
leave enter nextstate aassign pushmark const a const b pushmark rv2av gv nextstate sassign shift rv2av gv rv2sv scope shift rv2av gv
In reply to Re: Re: Matching and order of evaluation
by diotalevi
in thread Matching and order of evaluation
by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |