Huh? I don't get that. How is it easier to write an expression that isn't depending on the order of evaluation if the order of evaluation is defined?

It doesn't. I just means you do not have to guess.

Not at all. Just don't write expressions which use operators whose order of evaluation isn't defined, but whose outcome does depend on the order of evaluation.

And which ones are they? Is that written down somewhere? I think we both know it isn't.

For instance, my previous example could have been written as:
my $tmp = f(2); print $tmp + f(3);

So, you are advocating never using compound statements. Or at least, never using them if they order of evaluation could affect the outcome.

Except that you haven't told us when that is, so that amounts to the same thing. Don't use them--introduce a bunch of unnecessary temporary variables and increase the risks of inadvertant interspersion--or, try everything both ways and hope that "future enhancements" don't change things. Except, if they are never going to change, why leave them undefined in the first place?

So, you need order of execution to do things in parallel, but because there's an order of execution, two things can't happen in parallel?

No. If the execution order is defined, then it becomes possible for the programmer to write code knowing what that execution order is. And in autothreading ever makes it into the language, the compiler can generate the required locking to ensure that syncpoints are generated to match the programmers syntactically defined requirements. Without a defined order, the compiler can only guess what the programmer meant, and the programmer can only guess what the compiler will do.

You're wrong.

I may be, but nothing in your post supports that conclusion, and much of your post confirms the contrary.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco.
Rule 1 has a caveat! -- Who broke the cabal?

In reply to Re^6: Why is the execution order of subexpressions undefined? by BrowserUk
in thread Why is the execution order of subexpressions undefined? by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.