From: Hal Fulton Date: 2004-01-28T01:34:36+09:00 Subject: Re: newbee question about "missing" hash methods +, += and << ts wrote: >>>>>>"b" == benny writes: > > b> thats the behaviour of arrays and I know that I could extend the class > b> Hash, so that its supported. I simply want to know if there is a special > b> reason why it is not supported by default. > > What do you do if the key exist ? > > Array#+ always add elements, with Hash#+ keys will be added only if the > key don't exist otherwise the old value is replaced. I have seen this discussion before. It doesn't bother me much that keys are replaced. That is the nature of a Hash, that keys are unique. What bothers me more: If h2 and h3 have common keys, then h1 = h2 + h3 is not the same as h1 = h3 + h2 In other words, I expect + to be commutative always. But probably someone will now show me a case where it is not in Ruby. :) Hal