develooper Front page | perl.perl5.porters | Postings from January 2012

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

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
January 12, 2012 18:35
Subject:
Re: [perl #47948] [documentation] Hash::Util::FieldHash
Message ID:
CAHhgV8gfpwkdBo2U4jJ5UFVHUujJQ9nVahPoTNGA_858XRbP=A@mail.gmail.com
On Fri, Jan 13, 2012 at 3:08 AM, Father Chrysostomos via RT
<perlbug-followup@perl.org> wrote:
> My question is: Why is it unsafe at all to create or delete things from
> a hash that is being iterated?
>
> There have been at least three fixes to the deletion code since 5.14.
> Could it have anything to do with those?

One obvious problem would be reallocation. It can reorder the buckets,
thus causing the iteration to become unreliable. This is one reason
why C++ initially supported only treemaps: they provide reliable
iteration even in the face of map mutation.

Leon

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