From: Austin Ziegler Date: 2006-08-15T02:01:29+09:00 Subject: Re: A use case for an ordered hash On 8/14/06, gwtmp01@mac.com wrote: > Can't you just maintain an internal array representing the key insertion > order? Something like: > > class OHash < Hash > # ... > def each > keyseq.each { |k| yield k, self[k] } > end > end > > Where keyseq is just an array that is updated whenever keys are > added/deleted? It's a little more complex than that, but that's pretty much what all existing implementations do. We're talking about wanting a way of having an ordered associative list (that defaults to insert ordering, but can be changed to a sorted ordering, perhaps) in the Ruby core language *with a literal constructor*, because there is value for it. -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca