"Mark Wilson" <mwilson13 / cox.net> wrote in
....

following up on your example. Assuming that <,<=, ..
were left associative "comparison chaining" could
work like this

---
class Fixnum
  alias __lt <
  alias __le <=
  alias __gt >
  alias __ge >=
  def <(r)
    __lt(r) ? r : nil
  end
  def <(r)
    __lt(r) ? r : nil
  end
  def <=(r)
    __le(r) ? r : nil
  end
  def >(r)
    __gt(r) ? r : nil
  end
  def >=(r)
    __ge(r) ? r : nil
  end
end


class NilClass
  def <(r)  self end
  def <=(r) self end
  def >(r)  self end
  def >=(r) self end
end


p ((4 < 5) < 6) < 7  # 7

p ((4 < 5) < 5) < 7  # nil

p ((4 < 5) >= 5) < 7 # 7
----

Personally I wouldn't mind such a semantic but it is
probably too wired for general consumption ...

/Christoph