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:
David Golden
Date:
July 15, 2010 11:11
Subject:
Re: Order of evaluation of terms (was peephole optimiser could prune more dead code)
Message ID:
AANLkTimaCp9Brx2ESjeC4x5g2oJGOUErfv6g_ZmxjIfw@mail.gmail.com
On Thu, Jul 15, 2010 at 12:30 PM, Zefram <zefram@fysh.org> wrote:
> David Golden wrote:
>>Thus it seems clear that functions get evaluated first.
>
> Precedence does not (directly) affect order of evaluation.  It affects
> how terms are grouped and combined after they have been evaluated.

Again, from perlop:

       Operator precedence means some operators are evaluated before others.
       For example, in "2 + 4 * 5", the multiplication has higher precedence
       so "4 * 5" is evaluated first yielding "2 + 20 == 22" and not "6 * 5 ==
       30".

I'm not trying to be a language pedant here, I'm just saying that *as
written* the documentation clearly states a particular order of
operations.

I'm agnostic as to whether that implies that code or documentation
needs to change as a result.

-- David

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