TrueClass === TrueClass

Hi all,
why is:

TrueClass === TrueClass # false
Object === Object # true

Documentation states that === method is used to provide meaningful semantic in case statements. Can anyone explain me why some classes returns false?

thnx,
Bojan Mihelac

···

--
Bojan Mihelac
Informatika Mihelac, Bojan Mihelac s.p. | www.informatikamihelac.com
-> tools, scripts, tricks from our code lab: http://source.mihelac.org

Bojan Mihelac wrote:

Hi all,
why is:

TrueClass === TrueClass # false
Object === Object # true

Documentation states that === method is used to provide meaningful
semantic in case statements. Can anyone explain me why some classes
returns false?

  === returns true with one class if you 'compare' it to an instance of
the class:

irb(main):002:0> TrueClass == TrueClass
=> true
irb(main):003:0> TrueClass === TrueClass
=> false
irb(main):004:0> TrueClass === true
=> true

  Cheers,

  Vince

···

--
Vincent Fourmond, PhD student
http://vincent.fourmond.neuf.fr/

Bojan Mihelac wrote:
> Hi all,
> why is:
>
> TrueClass === TrueClass # false
> Object === Object # true
>
> Documentation states that === method is used to provide meaningful
> semantic in case statements. Can anyone explain me why some classes
> returns false?

  === returns true with one class if you 'compare' it to an instance of
the class:

irb(main):002:0> TrueClass == TrueClass
=> true
irb(main):003:0> TrueClass === TrueClass
=> false
irb(main):004:0> TrueClass === true
=> true

  Cheers,

Ah - so Object === Object returns true because the second Object is an
instance of the first Object. How deceiving.

···

On 1/19/07, Vincent Fourmond <vincent.fourmond@9online.fr> wrote:

        Vince

--
Vincent Fourmond, PhD student
http://vincent.fourmond.neuf.fr/

Vincent Fourmond wrote:

Bojan Mihelac wrote:

Hi all,
why is:

TrueClass === TrueClass # false
Object === Object # true

Documentation states that === method is used to provide meaningful
semantic in case statements. Can anyone explain me why some classes
returns false?

  === returns true with one class if you 'compare' it to an instance of
the class:

irb(main):002:0> TrueClass == TrueClass
=> true
irb(main):003:0> TrueClass === TrueClass
=> false
irb(main):004:0> TrueClass === true
=> true

  Cheers,

  Vince

Thanx Vince, just what I looked for.
Bojan

···

--
Bojan Mihelac
Informatika Mihelac, Bojan Mihelac s.p. | www.informatikamihelac.com
-> tools, scripts, tricks from our code lab: http://source.mihelac.org

> Bojan Mihelac wrote:
> > Hi all,
> > why is:
> >
> > TrueClass === TrueClass # false
> > Object === Object # true
> >
> > Documentation states that === method is used to provide meaningful
> > semantic in case statements. Can anyone explain me why some classes
> > returns false?
>
> === returns true with one class if you 'compare' it to an instance of
> the class:
>
> irb(main):002:0> TrueClass == TrueClass
> => true
> irb(main):003:0> TrueClass === TrueClass
> => false
> irb(main):004:0> TrueClass === true
> => true
>
> Cheers,

Ah - so Object === Object returns true because the second Object is an
instance of the first Object. How deceiving.

If you are looking for a language in which not everything is an object,
there are plenty around :wink:

···

On 1/19/07, David Chelimsky <dchelimsky@gmail.com> wrote:

On 1/19/07, Vincent Fourmond <vincent.fourmond@9online.fr> wrote:

> Vince
>
> --
> Vincent Fourmond, PhD student
> http://vincent.fourmond.neuf.fr/
>

Robert

--
"The best way to predict the future is to invent it."
- Alan Kay

>
> > Bojan Mihelac wrote:
> > > Hi all,
> > > why is:
> > >
> > > TrueClass === TrueClass # false
> > > Object === Object # true
> > >
> > > Documentation states that === method is used to provide meaningful
> > > semantic in case statements. Can anyone explain me why some classes
> > > returns false?
> >
> > === returns true with one class if you 'compare' it to an instance of
> > the class:
> >
> > irb(main):002:0> TrueClass == TrueClass
> > => true
> > irb(main):003:0> TrueClass === TrueClass
> > => false
> > irb(main):004:0> TrueClass === true
> > => true
> >
> > Cheers,
>
> Ah - so Object === Object returns true because the second Object is an
> instance of the first Object. How deceiving.

If you are looking for a language in which not everything is an object,
there are plenty around :wink:

Oh, you misunderstand. Let me rephrase:

"How deliciously deceiving."

···

On 1/20/07, Robert Dober <robert.dober@gmail.com> wrote:

On 1/19/07, David Chelimsky <dchelimsky@gmail.com> wrote:
> On 1/19/07, Vincent Fourmond <vincent.fourmond@9online.fr> wrote:

>
> > Vince
> >
> > --
> > Vincent Fourmond, PhD student
> > http://vincent.fourmond.neuf.fr/
> >
>
> Robert

--
"The best way to predict the future is to invent it."
- Alan Kay

> >
> > > Bojan Mihelac wrote:
> > > > Hi all,
> > > > why is:
> > > >
> > > > TrueClass === TrueClass # false
> > > > Object === Object # true
> > > >
> > > > Documentation states that === method is used to provide meaningful
> > > > semantic in case statements. Can anyone explain me why some
classes
> > > > returns false?
> > >
> > > === returns true with one class if you 'compare' it to an instance
of
> > > the class:
> > >
> > > irb(main):002:0> TrueClass == TrueClass
> > > => true
> > > irb(main):003:0> TrueClass === TrueClass
> > > => false
> > > irb(main):004:0> TrueClass === true
> > > => true
> > >
> > > Cheers,
> >
> > Ah - so Object === Object returns true because the second Object is an
> > instance of the first Object. How deceiving.
>
> If you are looking for a language in which not everything is an object,
> there are plenty around :wink:

Oh, you misunderstand. Let me rephrase:

"How deliciously deceiving."

I was not sure, but I thought that if you really did not realize what was
going on I might give a hint :wink:
But of course you were, sorry for the noise.

Robert

···

On 1/20/07, David Chelimsky <dchelimsky@gmail.com> wrote:

On 1/20/07, Robert Dober <robert.dober@gmail.com> wrote:
> On 1/19/07, David Chelimsky <dchelimsky@gmail.com> wrote:
> > On 1/19/07, Vincent Fourmond <vincent.fourmond@9online.fr> wrote:

--
"The best way to predict the future is to invent it."
- Alan Kay