Issue #6225 has been updated by naruse (Yui NARUSE).


shyouhei (Shyouhei Urabe) wrote:
> Anyway there has been a long discussion around +s in programming languages.  For instance Perl uses dot to concatenate strings and avoid +s to concatename strings and/or arrays.  I see they are much more mature than us in this area.  Functional languages like Haskell also avoid defining + onto non-abelian groups.

On Perl, it is because for
 perl -e'print "1" + "2"' #=> 3
 perl -e'print "1" . "2"' #=> 12

Not because of symmetry.
----------------------------------------
Feature #6225: Hash#+
https://bugs.ruby-lang.org/issues/6225#change-25459

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/