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

Re: Eliminating the "rehash" mechanism for 5.18

Thread Previous | Thread Next
Ævar Arnfjörð Bjarmason
October 29, 2012 17:42
Re: Eliminating the "rehash" mechanism for 5.18
Message ID:
On Mon, Oct 29, 2012 at 7:03 PM, Jesse Luehrs <> wrote:
> On Mon, Oct 29, 2012 at 06:55:21PM +0100, demerphq wrote:
>> What do people think?
> We have had to deal with this issue for quite some time in Moose - minor
> changes to internal implementation details can change the order that
> things are inserted into hashes, causing hash iteration order to change,
> and this ends up looking like a Moose bug when in reality it's because
> people are relying on hash iteration order in general staying
> consistent. If hash iteration order is always random on a per-invocation
> level, these bugs will never be able to be introduced in the first
> place, which would save a lot of pain when refactoring things.

I fully agree with this proposal, and I think this point Jesse raised
is really important.

By randomizing the seed on startup we're immediately breaking code
relying on undefined behavior that would have broken eventually in far
more subtle ways.

If that was all this proposal was about I think it would be worth it,
but speedups in the hash code and the ability to have extra hash
algorithms is just more icing on the cake.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About