in reply to Re^6: Pre vs Post Incrementing variables
in thread Pre vs Post Incrementing variables

You appear to be saying that the ability to describe what the implementation does, justifies why it does it that way.

The fact that this:

$i=0; print $n = ++$i, $m = ++$i;; 1 2
produces a different result to this:
$i=0; print ++$i, ++$i;; 2 2

Is just plain weird. Some, including me, would say 'broken'.

Justifying the weirdness by saying "that's what it does", kinda reminds of Apple's "You're holding it wrong." explanation of Antennagate.

Replies are listed 'Best First'.
Re^8: Pre vs Post Incrementing variables
by repellent (Priest) on Sep 13, 2010 at 06:09 UTC
    No, I made no implied justification thus far.

    The root of my reply was merely to reveal my experimentation with assigning the return of (++$i) to some value (since I also ran into the same error message you got).

    Then, I attempted to explain the snippet you posted so that others may find it helpful to see what's going on.

    My opinion? Yeah, the lvalue stuff is confusing and I don't quite see its usefulness. I would expect the behavior the OP expected.
      I made no implied justification

      Then I apologise for misunderstanding your point.

      When I said: "Mind you, it might make explaining this one a tad awkward :)", I meant explaining the logic behind it, rather than the implementations behaviour.


      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.