On Fri, 2 Apr 2004, Yukihiro Matsumoto wrote:

> Hi,
> 
> In message "parent of TrueClass, FalseClass"
>     on 04/04/02, "Ara.T.Howard" <Ara.T.Howard / noaa.gov> writes:
> 
> |any good reason these would not have a common parent Bool or something?
> 
> Is there any good reason to have a common parent Bool, where true and
> false are only representations values of truth.
> 
> 							matz.

well - no, except that i'm sure alot of code would break if we pulled out
TrueClass and FalseClass.  i guess you surely could have something like

  class Bool
    TRUE = new
    FALSE = new
    ...
  end

if done from the start this would make some sort of sense.  i just find it a
bit suprising that true and false, which are both representations values of
truth, are not related in anyway (duck type, module inclusion, parent class,
etc) and it is difficult (verbose) in ruby code to ask

  "is this a truth value"

i realize ruby is moving more towards duck typing.  but considering that - how
to you duck type a truth value?  i mean, which method must something
respond_to? in order to be a bool?  could it be useful if there was one?

  class Foo
    include Truth

    def initialize arg
      @bar = true if arg == 42
    end

    def truth           # all logical operations derived from this
      true unless @bar 
    end
  end

  xor = Foo.new(0) ^ Foo.new(42) 


-a
-- 
===============================================================================
| EMAIL   :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE   :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| URL     :: http://www.ngdc.noaa.gov/stp/
| TRY     :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done 
===============================================================================