From: ara.t.howard@noaa.gov [mailto:ara.t.howard@noaa.gov]
Sent: Friday, March 31, 2006 8:21 AM
To: ruby-talk ML
Subject: Re: TrueClass/FalseClass vs. Boolean> "baumanj@gmail.com" <baumanj@gmail.com> writes:
>
>> Since everything in ruby is an object, there need to be
objects for
>> representing true and false. Once you have those, why do
you need a
>> Boolean class?
>
> if a.kind_of? Boolean
>
> case y
> when Integer
> when Boolean
> end
>
> I often wanted this shortcut...indeed. i tend to use
case obj
when Klass
when TrueClass, FalseClass
endwhich is ugly.
another thing a real Boolean class could give is a 'maybe'
obj such thatmaybe or true -> maybe
maybe or true and false or true -> maybe
maybe and false -> maybealthough i can't think of anything attm to do with this it
would undoubtably lead to some nice logical constructs that
more closely parallel the way we think.
Think 'NULL' in databases, where 'NULL' is may not mean true or false,
but unknown. At the moment, NULL maps to nil, which is false.
i've brought this up once or twice before - maybe we should
just put together a patch and send to ruby-core?
It's been proposed and rejected by Matz once already.
Regards,
Dan
···
-----Original Message-----
On Fri, 31 Mar 2006, Christian Neukirchen wrote: