develooper Front page | perl.perl5.porters | Postings from July 2013

Re: [perl #47948] [documentation] Hash::Util::FieldHash

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
July 10, 2013 01:57
Subject:
Re: [perl #47948] [documentation] Hash::Util::FieldHash
Message ID:
20130710015643.GA24806@cancer.codesimply.com

The docs on `each` were revisited during the hash overhaul in 5.17.  The
assertion is that you can delete the most recently retrieved key safely, but
deleting any other key may change the iteration order.  I believe this was also
asserted on the list.

The docs for FieldHash say:

> If anything you do inside the loop could cause an object to go out of scope,
> a random key may be deleted from the hash you are looping over.

This matches the assertion in the `each` docs.

Unless perlfunc's entry for each is wrong, there is no contradiction.

I believe Yves said that he did work to keep deleting the current key safe.
MJD's mistake, if any, would be to say that you could delete *any* key you'd
already visited, rather than the *one* key you *just* got.

I think the docs are correct.  Perhaps someone -- Yves? -- could confirm.

-- 
rjbs

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About