Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Re: Incrementing a Hash Value

by Elian (Parson)
on Jun 14, 2002 at 18:48 UTC ( [id://174690]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Incrementing a Hash Value
in thread Incrementing a Hash Value

Proof by experimentation's not valid for programming languages. Bad, bad idea. (This isn't physics here--the rules of the universe are subject to change from version to versions) Only what the standard, or the documentation, guarantees is valid to count on. Everything else should be considered a quirk of the implementation.

This bit, in particular, could easily be changed with a small cahnge to the optimizer, or optree generator. That it hasn't happened is mainly because nobody's bothered. (Well, because that part of the code's reasonably scary) Because of the way that perl works internally, both the pre and post increment versions of that code could easily resolve to 6.

Trust Abigail here. Don't count on the behaviour of multiple manipulations to a variable without an intervening sequence point.

Replies are listed 'Best First'.
Re: Re: Re: Re: Incrementing a Hash Value
by Juerd (Abbot) on Jun 14, 2002 at 19:15 UTC

    Only what the standard, or the documentation, guarantees is valid to count on. Everything else should be considered a quirk of the implementation.

    Shouldn't there be a lot more documentation, then? Increments and decrements are not the only things being documented vaguely.

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

      Yep, there should be, or at least more specific docs on how things should act. Perl is awfully fuzzy about the behaviour of a lot of things. (Witness the fact that perl only recently nailed down the behaviour of numeric operations)

      As a for example, in this:

      $a = $a + $a++;
      what should $a equal at the end? And if $a is tied or overloaded, what order should the tie/overload stuff be called in?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://174690]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-25 14:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found