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
From:
demerphq
Date:
July 15, 2010 15:18
Subject:
Re: Order of evaluation of terms (was peephole optimiser could prune more dead code)
Message ID:
AANLkTilHWgDcMTa7Kcfi9t2YtkfJdIer-qGmpxs_ALO5@mail.gmail.com
On 15 July 2010 22:16, David Golden <xdaveg@gmail.com> wrote:
> On Thu, Jul 15, 2010 at 3:42 PM, Zefram <zefram@fysh.org> 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:

<quote>
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.
</quote>

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.

Yves





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

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About