Project

General

Profile

Actions

Feature #474

closed

Hash#<<

Added by Anonymous over 16 years ago. Updated over 13 years ago.

Status:
Rejected
Target version:
-
[ruby-core:18370]

Description

=begin
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?
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0