Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Ouch! Each! Reentrant it is not

by eric256 (Parson)
on Jul 15, 2005 at 16:03 UTC ( #475269=note: print w/replies, xml ) Need Help??


in reply to Re: Ouch! Each! Reentrant it is not
in thread Ouch! Each! Reentrant it is not

It would seem that if the iterator was scoped then this wouldn't be a problem. Falling out of scope (end of the for each, or sub) would cause it to be deleted. The next call would reset it, of course this couldn't be changed now because there is surely code depending on that behaviour. I wonder if perl6 handles this better. Maybe in it hashes can return an iterator (or maybe they should if they don't).


___________
Eric Hodges

Replies are listed 'Best First'.
Re^3: Ouch! Each! Reentrant it is not
by BrowserUk (Pope) on Jul 15, 2005 at 17:14 UTC

    I really expected that localising the hash would localise the iterator. If anything were to be done about the current situation, making it so that it was would seem to be the most transparent way least likely to interfere with existing code use.

    I'd be very surprised if this wasn't fixed in P6.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2020-06-05 06:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (35 votes). Check out past polls.

    Notices?