good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^2: Why is the execution order of subexpressions undefined? (victim)by tye (Sage) |
on Apr 12, 2005 at 05:12 UTC ( [id://446846]=note: print w/replies, xml ) | Need Help?? |
I think you've fallen victim to the temptation that I posted about. I don't believe that Perl defines the order of evaluation of expressions based on the precedence table. That determines what the results will be but need not restrict Perl to arriving at the proscribed value in the exact order that you appear to have defined based on how Perl has so far been implemented. It would be sad if Perl 6 were not free to optimize
By noting that $y + 1 is used twice and therefore could be computed beforehand and the result just used twice rather than computing it twice. But if you tie Perl's hand by saying that execution order is defined for such things, then Perl 6 will have no choice but to not optimize expressions, thwarting part of what was advertised as a big motivation for Parrot: the ability to optimize bytecode. - tye
In Section
Seekers of Perl Wisdom
|
|