thoran / thoran.com wrote:
> I was surprised to find the following...

[snip]

This has been discussed many times over the last
six years. Do a search of the archives.
> 
> It doesn't seem very PoLS to have it reordered, although perhaps one 
> shouldn't be surprised that a hash is unordered?  Perhaps Matz is 
> convincing us of this statement?  Said Matz unto the flock in a loud, 
> Godly voice: "Make no assumptions about the order of hashes!"

Don't invoke POLS. It's Matz's surprise that matters, not yours or
mine. And his voice is anything but loud.

> 
> Even so, would some unwritten law be being broken if I did this stuff?
> 

Personally I favor introducing an ordered hash of some form into Ruby.
Other people don't. Many want the original Hash kept as it is for speed
(though I am still unconvinced that merely keeping a sequence number
along with each key would impact speed dramatically).

What might be best is a class that inherits from Hash and preserves
order. We'd need a literal notation, however.


Hal