Then it would seem that you either didn't read or didn't understand the thread in question, since in Re: Auto-increment frenzy Abigail-II correctly points out that the order of evaluation in that case has nothing whatsoever to do with operator precedence. Operator precedence has absolutely nothing to say about the order in which the two terms to a binary operator are evaluated. Terms ain't operators. But even if you happen to know or guess that the left term is usually evaluated before the right one, you still can't assume that the post-increment happens right when the old value is returned. Legally it can happen any time up until the next statement. But again, this is a run-time issue, not a parsing issue. Just because operator precedence places some constraints on the order of evaluation doesn't mean that we should use the former term to mean the latter. Okay, maybe you did understand the thread--I can see that maybe you're just using the term differently, but if so, what you have to understand is that "operator precedence" is a technical term in computer science, and to use it generically like that will make computer scientists think you're spouting nonsense.

So yes, there are certainly "edge cases" in the order of evaluation when it comes to side effects. Every imperative computer language has them. (Which is one reason people fall in love with functional languages.) So in the documentation for an imperative language, you'll almost always find something that says something like: "Relying on the order of evaluation for side effects is erroneous. Just don't do that. Use a separate statement if you want to guarantee order of evaluation."


In reply to Re: Re: Re: Re: Short Circuit Operator and Hash Assignment by TimToady
in thread Short Circuit Operator and Hash Assignment by periapt

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.