logo       

class === class often false?: msg#01156

lang.ruby.general

Subject: class === class often false?

Hi,

I'm just noticing that some classes return true when testing
themselves with #===, while others return false. For instance:

(ruby 1.6.6 (2001-12-26) [i586-mswin32])
irb> Bignum === Bignum
false
irb> Bignum.id === Bignum.id
true
irb> Bignum == Bignum
true
irb> Bignum.ancestors
[Bignum, Integer, Precision, Numeric, Comparable, Object, Kernel]
irb> Kernel === Kernel
true
irb> Object === Object
true
irb> Comparable === Comparable
false


. . . It appears Comparable may be the culprit? Though, I've
noticed Enumerable introduces the same kind of behavior.

Just wondering if this behavior is intentional, and if so, why?


Thanks,

Bill







<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise