------art_87949_10496634.1151607572709
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 6/29/06, Joel VanderWerf <vjoel / path.berkeley.edu> wrote:

> That doesn't seem to stop Set#<< :
>
> irb(main):001:0> s  et[1,2,3]
> #<Set: {1, 2, 3}>
> irb(main):002:0> s << 4
> #<Set: {1, 2, 3, 4}>



That's because the semantics make sense in the context of Set. Set acts like
an unordered list, not like a Hash. There's certanily some hand-waiving
going on to make << work with the Hash, but as has been shown, that's not
too tough. IMO, appending '5' to a list of numbers {1,2,3,4} makes sense
while appending a key/value pair doesn't.

From the doc: 'Set
<http://www.ruby-doc.org/core/classes/Set.html>implements a collection
of unordered values with no duplicates. This is a
hybrid of Array <http://www.ruby-doc.org/core/classes/Array.html>'s
intuitive inter-operation facilities and
Hash<http://www.ruby-doc.org/core/classes/Hash.html>'s
fast lookup."

|| Dean

------art_87949_10496634.1151607572709--