develooper Front page | perl.perl5.porters | Postings from July 2010

Re: Order of evaluation of terms (was peephole optimiser could prune more dead code)

Thread Previous | Thread Next
July 15, 2010 15:18
Re: Order of evaluation of terms (was peephole optimiser could prune more dead code)
Message ID:
On 15 July 2010 22:16, David Golden <> wrote:
> On Thu, Jul 15, 2010 at 3:42 PM, Zefram <> wrote:
>> Precedence and associativity imply certain things about order of
>> evaluation, but the implications are minimal.  In general, if a language
>> does not have other specific guarantees about order of evaluation, any
>> order is acceptable for the evaluation of the atomic terms and for the
>> operations represented by the operators.  The order is constrained only
>> by the inherent need for the operands of any single operation to have
>> each been fully evaluated before that operation can take place.
> Sounds like something that should go into perlop.

I agree, and I think that Jan's comment:

My personal opinion is that any FETCH magic or overloaded operator that
has observable side effects is essentially broken and abusing a feature.
You can always use a function or method call if you need exact control
over how your code is being called.

should, after appropriate editing, be added to the documentation for
tie as well.

I wonder if we should arrange for a debugging mode where the order
that terms were evaluated was reversed, or randomized, or whatever. It
would be educational I think to find out just how much breaks.


perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About