[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: TrueClass/FalseClass vs. Boolean

Berger, Daniel

3/31/2006 3:31:00 PM



> -----Original Message-----
> 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
>
>
> On Fri, 31 Mar 2006, Christian Neukirchen wrote:
>
> > "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
> end
>
> which is ugly.
>
> another thing a real Boolean class could give is a 'maybe'
> obj such that
>
> maybe or true -> maybe
> maybe or true and false or true -> maybe
> maybe and false -> maybe
>
> although 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



2 Answers

Ara.T.Howard

3/31/2006 3:36:00 PM

0

Slackjaw

2/12/2013 7:19:00 PM

0

On Feb 12, 11:23 am, Man of Mind <baron.von.m...@gmail.com> wrote:
> On 2/12/2013 10:05 AM, Faulty Sham <wsjames...@gmail.com> whined:
>
>
>
> > On Feb 12, 10:36 am, Man of Mindwas amused by the mental short-cuts of:
>
> >> On 2/12/2013 9:33 AM, Faulty Sham <wsjames...@gmail.com> whined/opined:
>
> >>> You do know that your it is a quadratic equation, not linear,
> >>> don't you, wy???
>
> >> WTF!? Are you off your meds again?
>
> > Hey Kurt can you solve this?

What is (26 - 2i) / (3 + 5i) ? Where i = square root of -1
>
> I'm not solving your problems for you today, Faulty Sham..

> Translation: Duh, no way, duh, I have no idea how to solve that, duh...

OK, how about something simpler, down to your level. Can you solve
this one?

x^2 = x + 6

where "x^2" is "x * x" or x squared.


>
> Unskilled and unaware of it: how difficulties in recognizing
> one's own incompetence lead to inflated self-assessments.
>
> http://www.ncbi.nlm.nih.gov/pubme...
>
> --
> "Conservatives have no ideas; just irritable mental
>   gestures which seek to resemble ideas"
>                               -Lionel Trilling