Issue #6555 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Rejected I am still in doubt for adding more comparison operators. We need clear benefit to make a big change like this. Matz. ---------------------------------------- Feature #6555: New comparison operators https://bugs.ruby-lang.org/issues/6555#change-31778 Author: jEFF (Jean-François Berroyer) Status: Rejected Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: 2.0.0 =begin x <=> y returns -1, 0, 1 or nil (x <=> y) == -1 means "x less than y" and is the same as x < y (x <=> y) == 0 means "x equal y" is the same as x == y (x <=> y) == 1 means "x greater than y" and is the same as x > y (x <=> y) == nil means "x not comparable with y" and is the same as !(x <=> y) We see there is no short syntax to test if two objects are not comparable. Can we have something like (({x >< y})), provided by (({Comparable})) module, that would mean "x and y are not comparable" ? As (({x != y})) is a short syntax for (({!(x == y)})), can we have (({x !< y})) for (({!(x < y)})) and (({x !<= y})) for (({!(x <= y)})) and so on ? As (({x <= y})) is the same as (({(x < y or x == y)})), can we have (({x <> y})) for (({(x < y or x > y)})) ? Here is a list of all possible comparison operators there could be (and their meanings) : < return true when <=> return -1 ("less than") == return true when <=> return 0 ("egal") > return true when <=> return 1 ("greater than") <= return true when <=> return -1 or 0 ("equal or less than") >= return true when <=> return 1 or 0 ("equal or greater than") <> return true when <=> return 1 or -1 ("less or greater than" that is to say "comparable and different") >< return true when <=> return nil ("not comparable") !< return true when <=> return 0 or 1 or nil ("not less than", that is different from "greater than or eqal" that involves "comparable") != return true when <=> return -1 or 1 or nil ("not equal", that is different from "less or greater than" that involves "comparable") !> return true when <=> return -1 or 0 or nil ("not greater than", that is different from "less than or eqal" that involves "comparable") !<= return true when <=> return nil or 1 ("not equal nor less than", that is different from "greater than" that involves "comparable") !>= return true when <=> return nil or -1 ("not equal nor greater than", that is different from "less than" that involves "comparable") !<> return true when <=> return 0 or nil ("not less nor greater than", that is different from "egal" that involves "comparable") !>< return true when <=> return -1 or 0 or 1 ("not not comparable" or just "comparable", the same as <=> but returning a boolean) All these operators would be very useful, especially when working with partial orders (like subset-inclusion for exemple). Perhaps (({x !== y})) should also be a short syntax for (({!(x === y)})). =end -- http://bugs.ruby-lang.org/