From: Christoph Rippel Date: 2001-06-16T19:27:14+09:00 Subject: [ruby-talk:16534] Re: why only nil and false are regarded as false? > From: dave@thomases.com [mailto:dave@thomases.com]On Behalf Of Dave ... > Do you have some examples where you'd like other values to be false? Well I do have an example for this, a while back I outlined a ``logical Infinity module''[ruby-talk:13469] which adds two visible ``+/- Infinity constants'' (instanced with Infinity.plus and Infinity.minus) to the Numeric hierarchy. The basic idea is to delegate ``if-then-else'' constructs which handle ``extremal states'' from regular program flow to the Infinity Class itself - the most obvious are examples are the min/max values for empty Enumerable - with the 1.7 version you can write require 'infinity' module Enumerable Minus= Infinity.minus def max; inject(Minus) {|a,b| (a > b ) ? a : b } end end end In most situation the ``correct logical value'' of Infinity.minus should be false - without a fundamental language change one can achieve this effect by adding a ``to truth'' method to Object ... Christoph Ideally one would evaluated the Infinity instances > > Dave >