Austin Ziegler wrote:
> On 8/21/06, Just Another Victim of the Ambient Morality
> <ihatespam / rogers.com> wrote:
>>     I think what you are thinking of is a red black tree (or just a 
>> binary
>> tree, in general) and not a hash...
> 
> No, people are thinking of an associative array or an association list
> as someone else called it in this thread. I'm not sure about r/b
> trees, but binary trees are most *definitely* not what is wanted since
> what is wanted is insertion order in most cases, not an arbitrary
> sorted order.
> 
>>     Honestly, complaining that hashes aren't ordered is like complaining
>> that rand() doesn't return the same number every time.  Pray tell, what
>> made you think it should be ordered?  That was an honest question, by the
>> way!  You know enough about programming to come here and decree that this
>> is very weird yet you didn't already know what a hash is or how one 
>> works.
>> Very strange...
> 
> PHP's "array" is an associative array allowing "hash"-like handling
> with an ordered iteration. That's probably the source of 99% of the
> reasons that people want it.
> 
> -austin

I don't think 'ordered' is a good name for something sorted by 
_insertion order_.

I am probably 'tainted' by my exposure to the Java API, but just like I 
expect an ordered tree to be sorted by value, I'd expect an ordered map 
to be sorted by key.

Insertion order maps are very useful too, and I'd love to see both added 
to the Ruby stdlib. I(o?)Hash and OHash? Let's keep Hash as lean and 
mean as possible.


Isak