From: Jeff Mitchell Date: 2004-07-08T06:24:59+09:00 Subject: Re: Class#=== has interesting results --- "David A. Black" wrote: > On Thu, 8 Jul 2004, Charles Comstock wrote: > > 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. > > It doesn't match the descendants of A, but rather instances of the > descendants of A: > [...] He is asking why isn't === defined as class Module def ===(obj) obj.is_a?(self) or obj == self end end or maybe class Module def ===(obj) obj.is_a?(self) or obj.ancestors.include?(self) end end Not that I advocate either definition. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com