Issue #6225 has been updated by alexeymuranov (Alexey Muranov).


Martin, it is common to use * for both commutative and non-commutative operations but + for only commutative.

But i am more in favor of Matz's argument, because i didn't bother myself about the fact that string addition is non -commutative.

duerst (Martin Dürst) wrote:
> In common sense, * is also commutative. But of course, for matrix multiplication, it's not.
> 
> Also, + is used in many fields of mathematics. I'm not a mathematician, but I very strongly doubt that it's commutative in all these cases. (see e.g. http://arxiv.org/abs/1003.2081 for an example)
> 
> What's much more important is whether the + for Hash fits the general image a Ruby programmer has for +. I'm not exactly sure about this, but the parallel with Array is not too bad.


----------------------------------------
Feature #6225: Hash#+
https://bugs.ruby-lang.org/issues/6225#change-25861

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/