Hal Fulton wrote: > Your point is well taken. > > However, it remains to be seen whether it would kill the speed. > Personally I doubt it would be significant, but I've seen no > numbers one way or the other. > > Memory I would consider a more serious issue. Every pair in the > hash would occupy an extra N bytes (addmitedly a low value of N, > like 4). In the case of 30,000 pairs, that's an additional (say) > 120K of RAM used. > > As for "one person's benefit" -- it's true that the people > wanting this functionality are in the minority. But we are > far more than one person. :) > > > I know an ordered associative array (which I think is a better > > description of the functionality) would make some things very easy, > > but replacing the Hash is not the way to go. > > That is definitely a better description of the finctionality. > > I would even say that "associative array" alone would be a sufficient > term, since "array" implies order. (But I may be wrong there.) > > I'd be happy with a separate class for that functionality *IF* there > were a convenient notation for literals. (For example, the combination > of square brackets and arrows that I mentioned previously, which Ruby > currently interprets as an array with a single element which is a hash.) > > Without the literal notation, it would be to me just another kludge. +1 for Hal Also, while not a full fledged class in it's own right, you might find Facets' association.rb useful. Ex. c = [ :a >> 1, :b >> 2 ] c.each { |k,v| puts "#{k} associated with #{v} } T.