From: Charles Comstock Date: 2004-07-08T05:52:34+09:00 Subject: Re: Class#=== has interesting results On Thu, 8 Jul 2004, David A. Black wrote: > Hi -- > > On Thu, 8 Jul 2004, Charles Comstock wrote: > > > Mauricio Fern�ndez wrote: > > > > > On Wed, Jul 07, 2004 at 04:22:36PM +0900, Charles Comstock wrote: > > > > > >>Why does this happen? > > >> > > >>class A > > >>end > > >> > > >>A == A #1 => true > > >>A === A #2 => false > > >> > > >>But 2 doesn't make any sense to me, why doesn't an A match another A? > > >>Is this just something that slipped through or is there a specific > > >>reason for this? > > > > > > > > > A is not an instance of A; see the ri info for Module#===. > > > > > > > At what point does it cause trouble for it to also return true if the > > class matches? > > At the point where you call it :-) It can't do both; there would be no > way to interpret the result: > > case s > when String ... # what do you do here? print it? instantiate it? > Sorry perhaps I didn't word my question well. I meant when does it cause a problem for a class x to match itself? What code fails if A === A results in true? Why would you ever want to match the descendents and instances of A but not match A itself. Charles Comstock