----- Original Message ----- 
From: Stefan Matthias Aust <sma / 3plus4.de>
To: ruby-talk ML <ruby-talk / ruby-lang.org>; <ruby-talk / netlab.co.jp>
Sent: Monday, May 28, 2001 11:10 AM
Subject: [ruby-talk:15886] Q about TrueClass & FalseClass


> Hi!
> 
> Is there any special reason why TrueClass and FalseClass are direct
> subclasses of Object?  I stumbled across this (IMHO problem) when I
> was trying to test for a boolean type, writing 
> 
>   object.kind_of? Boolean
> 
> and noticing that actually there's no Boolean class.  IMHO, it would
> be helpful in some situations if there would be such a common
> superclass.  Looking into object.c, it seems it would be a trivial
> change to add this class.

Or do it trivially in Ruby. Though it's somewhat meaningless.

module Boolean
end

class TrueClass
  include Boolean
end

class FalseClass
  include Boolean
end


x = true

if x.kind_of? Boolean
  puts "yes"                       # yes
else
  puts "no"
end



Hal