Issue #6225 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas).


This argument really doesn't buy me. Groovy allows: [key1: 'value1', another: 1] + [key2: 'value2', another: 2] == [key1: 'value1', another: 2, key2: 'value2'].

I think this is pretty readable as + is also used to denotate unions. I don't think anyone would expect any behavior different from that.

Maybe someone could argue that the result could also mean [key1: 'value1', another: [1, 2], key2: 'value2'] but I think *that* would be really strange.
----------------------------------------
Feature #6225: Hash#+
https://bugs.ruby-lang.org/issues/6225#change-25435

Author: trans (Thomas Sawyer)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: 2.0.0


Strings and Arrays can be combined with #+. I don't see any reason not to allow Hashes to do so as well.

  class Hash
    alias :+ :merge
  end



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