From: "fuadksd (Fuad Saud)" Date: 2013-08-19T04:34:29+09:00 Subject: [ruby-core:56728] [ruby-trunk - Feature #7739] Define Hash#| as Hash#reverse_merge in Rails Issue #7739 has been updated by fuadksd (Fuad Saud). =begin Matz rejected (({+})) for merging, as it is different than addition. reverse_merge would probably be closer to the concept od addition, as it only adds data to the receiver. Also, give this, isn't the reverse_merge less appropriate name than add, or something else that suggest this behaviour. I'm ok with reverse_merge, but maybe this is food for thought. Any reason why shouldn't the polymorphic behaviour be incorporated into the merge/reverse_merge methods? Maybe they could try to convert the arg to a hash before - I'm not sure about this though. I'd stick with * ((*<<*)): merge! * ((*>>*)): reverse_merge! * ((*+*)): reverse_merge * ((*&*)) or ((*|*)): merge Also, just a comment: thinking about this, it would be nice too have the except method "imported" from ActiveSupport as well and have ((*-*)) aliased to it. =end ---------------------------------------- Feature #7739: Define Hash#| as Hash#reverse_merge in Rails https://bugs.ruby-lang.org/issues/7739#change-41257 Author: alexeymuranov (Alexey Muranov) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: next minor =begin I suggest for to define (({Hash#|})) as (({Hash#reverse_merge})) in ((*Rails*)), in my opinion this would correspond nicely to (({Set#|})), to the logical (({#||})) and to the bitwise (({#|})): { :a => 1, :b => 2 } | { :b => 1, :c => 2 } # => { :a => 1, :b => 1, :c => 2 } =end -- http://bugs.ruby-lang.org/