From: Robert Klemme Date: 2007-11-23T17:46:06+09:00 Subject: Re: Ordered Hash Usefulness 2007/11/23, Daniel Sheppard : > > > Well, that's just /one/ way to order a Hash. You could as > > well order a > > Hash by the key's natural order (<=>). > > Yes, but nothing extra needs to be added to Hash to get a > natural order enumeration - A hash.sort.each sorts that out. Which would still be something different than a Hash that automatically maintains this order. Granted, insertions would be O(log(N)) instead of O(1) but lookups could still be O(1). And you save the memory overhead of Hash#sort. > An ordered hash almost always refers to insertion order, as > that's the order that is unrecoverable from a regular hash. I just find the terminology a bit muddy because "ordered" in itself is too ambiguous. That's all I wanted to point out all the time. Kind regards robert -- use.inject do |as, often| as.you_can - without end