----- Original Message ----- From: <dblack / candle.superlink.net> To: "ruby-talk ML" <ruby-talk / ruby-lang.org> Sent: Monday, August 12, 2002 8:17 PM Subject: Re: class === class often false? > It's actually y.is_a? x Oh, yes. > which I think is to help with case statement syntax: Yes. > > Note also that if a class includes a module, it > > then has the "is a" relationship with that module, > > and an included module shows up in the list of > > ancestors. (Since a module is a kind of parent -- > > it's like a limited form of inheritance.) > > It is among the ancestors, but there's no is_a? or === relationship: (snip where you prove this) Hmm, brain fade on my part. Happens daily. > However, Array objects do return true on these tests: > > irb(main):026:0> [].is_a? Enumerable > true > irb(main):027:0> Enumerable === [] > true That must be what I was thinking. > A (whimsical) further test: > > irb(main):036:0> class Class; include Enumerable; end > Class > irb(main):037:0> Enumerable === Array > true > > So ancestors/is_a?/Module#=== are related but can vary independently. Yes, this is where my brain itches again. > Now, this one: > > irb(main):015:0> Kernel === Object > true > > is a little puzzling to me, because I would have thought Object:Kernel > was the same relationship as Array:Enumerable. Except... there is > that circularity/singularity at the top of the chain -- which I > alternate between thinking I understand and losing sleep over :-) In > this case I can't say I entirely understand exactly how/why it would > account for the result, but I think somehow it does. Probably true. I'll think about this more later. Hal