I have sent a little patch, defining HalfOrder, to ruby-core in order to
some help with a problem I have found. Maybe this was not the best
So I’ll try here again
basically the patch defines a module HalfOrder which defines “>”, “>=”,
and “==” depending on “<=”, well almost because a potential #== in the
class, as in Set cannot be overwritten. I think this is a shame.
Here goes some code expressed in ruby instead of C
Mixer has to define #<=
def == other
in case of performance problems you might want to define ==
self <= other && other <= self
Set.new == Set.new # works while it should raise a NoMethodError for a
well should as in I would like.
Any ideas? ( Maybe the HalfOrder module should complain or warn when
into a Class already containing a #==; guess I do not know how to do
The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man.
- George Bernard Shaw