Cannot override #== with mixin, was help with patch to ruby-

Hi all

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 :frowning:

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

module HalfOrder

Mixer has to define #<=

def == other

in case of performance problems you might want to define ==

self <= other && other <= self

class Set
include HalfOrder
end == # works while it should raise a NoMethodError for a
missing #<=

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
that in
C, yet)


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