From: Hal Fulton Date: 2006-08-14T14:14:02+09:00 Subject: Re: A use case for an ordered hash Austin Ziegler wrote: > > In the case that Hal is talking about, and in the case where > PDF::Writer uses an ordered hash, this would be inappropriate. > Insertion-ordered associations are generally better. I will probably > be modifying PDF::Writer a bit to make it clear that it's using an > ordered association, not an ordered "hash", but it would be useful to > have an ordered association. Maybe we *could* take advantage of a > literal for this: > > ordered_assoc = ( 1 => 2, 2 => 3, 'a' => 5 ) > > Maybe. For Ruby 2.0. Either (=>) or [=>] would be fine with me. I'd slightly prefer the latter. But the big question is, what would the class be called? I dislike long names such as Association or AssociativeArray or even OrderedHash. (I suppose the last might be best of those.) I once suggested Map -- a nice short name -- but there was some reason this wasn't acceptable. I'd even suggest (gasp) letting it inherit from Hash. Hal