I'm not sure how long this horse has been dead, but it seems to still be taking quite a beating... I have to put in a few licks regarding this comment of yours:
It's not a complicated or extravagant request:

Please make the language definition such that the compiler will do things in a predictable, defined sequence so that I the programmer can choose how I want them done. Even if the result is a tny weeny bit less efficient than it might be--which it never will be in Perl.

If I understand your request -- in terms of the OP that started this thread -- you would like to be able to write something like this:
my $rv = func( $i, ++$i, $i+2 );
and have it produce a consistent result every time, which is always equivalent to one of the following:
# either this: $rv = func( $i, $i+1, $i+2 ); $i++; # or this: $rv = func( $i, $i+1, $i+3 ); $i++;
Obviously, we can't have it both ways. I'm not enough of a language design expert to speculate on how hard it might be implement the kind of ordering definition you seem to be looking for; let alone how hard it might be to document (i.e. clearly explain for programmers of various skill levels) what the chosen ordering turns out to be for all the kinds of situations where this is an issue.

But the problem for me is that the initial expression, taken by itself without an external rule of interpretation, is inherently ambiguous. Whichever rule is chosen to make this statement unambiguous, it will be a relatively arbitrary choice. And I'll need to see and understand the documentation for it in order to figure out what that initial expression is really doing. (update: either that, or else I'll just have to experiment with it to see what it does)

The same issue comes up for me in cases where execution order is already well defined, like  $i*$j/$k*$l; -- sure, evaluation is simply left-to-right, and most languages are the same in this regard, so nobody should have any trouble with this. But I would still prefer to place the terms in an order that would be unambiguous regardless of the EO rules, and/or add some parens just to be sure. It's a small price to pay for clarity, given that the language is intended as much for human readers as for machines.

So my objection to your request is: why add arbitrary rules to the language, if the intent is simply to provide a consistent result for ambiguous expressions? IMHO, it would be better to be clear about what constitutes ambiguity in the language, and avoid it.


In reply to Re^19: Why is the execution order of subexpressions undefined? by graff
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.