From: James Edward Gray II Date: 2005-12-09T04:19:57+09:00 Subject: Re: ordered/sorted hash On Dec 8, 2005, at 12:57 PM, robertj wrote: > hi daniel, > >>> hash.sort.each{ |e| puts "#{e[0]} => #{e[1]}" } > this has the effect that clients of that hash > need to know that they must order the hash + > the interface for iteration has changed. > > instead of hash.each { |k, v| ...} you get hash.sort.each { |v| ...} > > in short your solution requires "sorting" to become part of > the "official" interface of my hash. You could easily wrap a Hash and provide an each() that sorted before yielding. James Edward Gray II