From: Robert Klemme Date: 2004-09-06T17:35:11+09:00 Subject: Re: Hashes and ordering "Markus" schrieb im Newsbeitrag news:1094423054.22479.602.camel@lapdog.reality.com... > > > Well, at least you can do > > > > def SortedMap(h) > > # any transformation of a Hash that > > # does not depend on insertion order > > # for example > > h.sort > > end > > > > foo = SortedMap( "foo" => "bar", "two" => 2 ) > > The problem (at least as I understand it) with this approach is that > he's wanting them in INSERTION order; there is no guarantee that the the > hash that comes into SortedMap will be in insertion order, and I don't > see how the h.sort will fix that. That's why I put in the other example. A SortedMap can only maintain one ordering and in this case it's the natural ordering of keys. robert