From: "alexeymuranov (Alexey Muranov)" Date: 2013-08-13T22:32:54+09:00 Subject: [ruby-core:56601] [ruby-trunk - Feature #7738] Deprecate Set#+ as an alias of Set#|, use it for symmetric difference. Introduce Hash#| for Hash#reverse_merge in Rails. Issue #7738 has been updated by alexeymuranov (Alexey Muranov). As i said, i will probably be surprised if this proposal is accepted :). However, i would like to answer: 1. 1 / x returns a result if x = 1, but raises an exception if x = 0. 2. I was proposing to change the behavior of Set#+, and leave Set#| as it is. I am not sure my proposal is very useful, but here are some motivations: 1. No duplicate methods under different names (some are using Set#|, others Set#+ for exactly same function). 2. More consistency of meaning of #+ between different classes. I do not know a very good use case of the new proposed function (raising an exception), but here is what comes to mind: combining two collections of objects where each object is expected to belong to exactly one collection. This would ensure that for two sets a and b, a + b - b will either return a, or raise an exception. But i admit these are not very important, feel free to close. ---------------------------------------- Feature #7738: Deprecate Set#+ as an alias of Set#|, use it for symmetric difference. Introduce Hash#| for Hash#reverse_merge in Rails. https://bugs.ruby-lang.org/issues/7738#change-41137 Author: alexeymuranov (Alexey Muranov) Status: Open Priority: Normal Assignee: knu (Akinori MUSHA) Category: lib Target version: Next Major =begin I am almost sure this will be rejected, but i want to try anyway. My goal is to propose a more efficient and consistent use of binary operator symbols for some classes, in this case for (({Set})) and (({Hash})). I propose to deprecate (({Set#+})) as an alias of (({Set#|})), and use (({Set#+})) later for the ((*symmetric difference*)) of sets. I think that operator symbols like (({+})) and (({|})) are too precious to alias one another. Currently (({Set#+})) is probably the only use of (({#+})) for an operation which is not ((*injective*)) in each of the arguments: for sets (({a})), (({b})), (({c})), the equality a + b == a + c does not currently imply b == c The natural binary operation on sets that is injective in each argument is the ((*symmetric difference*)), it corresponds to the bitwise XOR. I have also noticed that the "(({+}))" for sets is used in "Lectures on ergodic theory " by P. Halmos to denote the symmetric difference. I also suggest for to define (({Hash#|})) as Hash#reverse_merge in Rails, in my opinion this would correspond nicely to (({Set#|})). =end -- http://bugs.ruby-lang.org/