Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Incrementing a Hash Value

by Juerd (Abbot)
on Jun 14, 2002 at 11:56 UTC ( [id://174595]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

No, and that's the entire problem. You do not know when the increment will happen, that is specifically left undefined.

It is documented to be undefined (as you can't know when "after" will be), but the documentation is wrong ("before" is reality: the old value is stored in a temporary SV).

(It was left undefined in C to give implementers of compilers all sorts of freedom to optimize it - idem for Perl)

Perl will never be able to optimize $foo++ for real scalars, because they can be tied or overloaded at runtime. With Perl 6, when there are variables that are numbers but can never become a real scalar, maybe it can be optimized.

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

Replies are listed 'Best First'.
Re: Incrementing a Hash Value
by Abigail-II (Bishop) on Jun 14, 2002 at 12:08 UTC
    It is documented to be undefined (as you can't know when "after" will be), but the documentation is wrong

    Please submit a patch to p5p and see whether they agree with you.

    Abigail

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://174595]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.