Feature #474: Hash#<<
http://redmine.ruby-lang.org/issues/show/474

Author: Anonymous
Status: Open, Priority: Normal
Category: core

This was discussed a some months ago on Ruby-talk. I don't know if that discussion led to any consideration on Core, so I wanted to post it up as a feature request.

To recap, the idea is:

  h = Hash.new
  h << [:a, 1]
  h << [:b, 2]
  h #=> {:a=>1, :b=>2}

This creates a polymorphism between associative arrays and hashes, which ultimately could be useful to mixins. And now that Hash supports insertion order too, it makes further sense. There was a particular usecase exemplified in the fore-mentioned thread. But since I can't find it I can't show it here. I just recall thinking it was compelling. Perhaps other's can recall?


----------------------------------------
http://redmine.ruby-lang.org