It's got nothing to do with operand evaluation order.

Who said anything about operand evaluation order? (How could there be an operand evaluation order for a unary operator.)

I'll come back to this.

It has to do with pre-increment returning lvalues.
$i = 0; ++$i = 'fred';; Can't modify preincrement (++) in scalar assignment

So, not an lvalue.

is more or less equivalent to ... alias

Ah! That well know Perl keyword 'alias'....

It's got nothing to do with operand evaluation order.

Hm. "It" has everything to do with the fact that the evaluation order of sub-expressions is unspecified.

Where "it" is the contradictory and useless behaviour, observed by the OP, and repeated in my post.

Because, if were specified, then the implementation would not be able to get away with producing those totally illogical, useless results, for those unwise or unknowing enough to try and use, what could be a useful behaviour.

Your attempts to explain how the implementation produces these useless results from this unspecified and therefore deprecated code, does naught to detract from the reason why it has been possible to enshrine this broken behaviour in the implementation.

The fact that f( ++$n, ++$n ) passes an alias to $n, rather than the value resulting from the preincrement, is just another broken behaviour. It is equivalent to C allowing:

#include <stdio.h> void f( int *a, int *b ) { printf( "a: %d, b: %d \n", *a, *b ); *a = 1; *b = 2; } int main( int argc, char ** argv ) { int x = 0; f( &( ++x ), &( ++x ) ); return 0; }

Which it doesn't:

junk.c junk.c(11) : error C2102: '&' requires l-value junk.c(11) : error C2102: '&' requires l-value junk.c(11) : error C2198: 'f' : too few arguments for call

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

In reply to Re^3: Pre vs Post Incrementing variables by BrowserUk
in thread Pre vs Post Incrementing variables by SavannahLion

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.