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
From:
Joshua ben Jore
Date:
July 15, 2010 13:16
Subject:
Re: Order of evaluation of terms (was peephole optimiser could prune more dead code)
Message ID:
AANLkTinAPJQ_G-Ic0JqjF81OHglT5MbWXRn2F7eCAXbn@mail.gmail.com
On Thu, Jul 15, 2010 at 1:11 PM, David Golden <xdaveg@gmail.com> wrote:
> On Thu, Jul 15, 2010 at 3:43 PM, Jan Dubois <jand@activestate.com> wrote:
>> On Thu, 15 Jul 2010, Jan Dubois wrote:
>>> On Thu, 15 Jul 2010, David Golden wrote:
>>> Precedence and associativity are all about how the parser would insert
>>> parenthesis into an expression to disambiguate its meaning; it does not
>>> for example change the commutative property of addition: (a + b) has to
>>> be the same as (b + a), otherwise the operation is no longer an addition.
>>
>> Please ignore the part about the commutative property. While true, it is
>> unrelated to the rest of the argument in that post.  Sorry about that.
>
> I was amusedly thinking that it's not guaranteed to hold true when
> "evaluating" "a" and "b" have magic anyway.  (e.g. "a" is tied to
> increment when evaluated and "b" is tied to do something as a function
> of a.
>
> And then we come full circle to the debate that spawned this thread
> about what can be assumed about order of evalution.  :-)

Well, since I've noticed between releases that the number and order of
magic does in fact change, it's a) impactful to me but b) completely
ok to change because this order is generally undefined. I had tests in
Judy which looked to ensure that the right magic happened but would
occasionally break when perl would or wouldn't do an additional FETCH
or similar. My breakage was purely because I'd do an operation but log
all the magic and see if my log was "ok". I just had to become
sufficiently lax in my "ok enough" tests.

Josh

Thread Previous


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