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

But, $n_after_the_first_increment would be different, by 1, to $n_after_the_second_increment, but your own output--in both the relevant case and your two fantasy cases--shows both digits are the same.

It returns $n (the scalar, not the value within) after first increment, not some copy $n_after_the_first_increment after the first increment.

And the only way for that to happen, is for both pre-increments to have occurred, before the subroutine gets whatever it is given.

You are mistaken. The first result in placed on the stack before the second is evaluated. See the code in the grandparent.

Replies are listed 'Best First'.
Re^11: Pre vs Post Incrementing variables
by BrowserUk (Patriarch) on Sep 13, 2010 at 15:10 UTC
    You are mistaken.

    Nuh uh.

    The first result in placed on the stack before the second is evaluated.

    When the values are "placed on the stack" IS "before the subroutine gets whatever it is given.". It gets them when it takes them off the stack. And that can't happen until both have been placed on it.

    And by the time they have both been placed on the stack, which even you'll have to agree is "before the subroutine get whatever it is given", both increments have occurred.

    So, if (references to) the values resulting from the pre-increments were placed on the stack, instead of references to the preincremented variable, then the anomaly would not arise.

    And the only thing that allows it have been implemented as is, and to have persisted, is the previously, exhaustively described missive.


    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.

      When the values are "placed on the stack" IS "before the subroutine gets whatever it is given.". It gets them when it takes them off the stack.

      It gets them on the stack as far as I'm concerned. That a function only gets it arguments after it copes them is a silly concept, considering functions can (and often do) work on the arguments directly on the stack.

      So, if (references to) the values resulting from the pre-increments were placed on the stack, instead of references to the preincremented variable, then the anomaly would not arise

      There is no value resulting from the pre-increment to "reference". But if such a value were to be created (i.e. if $n were to be copied), then yes, that's correct. I mentioned this in my first post, so I think all's clear now?

        or are you being silly?

        Am I being silly! Me? You are the one that keeps telling me that I'm "mistaken", quoting passages that can not possible be wrong.

        You seem to perceptually misinterpret things that cannot possibly be misinterpreted. The only ways I can that happening so frequently, are if you are a) stupid; b) being deliberately obtuse; c) being deliberately contrary.

        And I know you are not stupid.

        All clear now?

        I have always been very clear. You are the only one who seems confused or ...


        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.