Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!feeder.erje.net!feeds.phibee-telecom.net!talisker.lacave.net!lacave.net!not-for-mail From: Brian Candler Newsgroups: comp.lang.ruby Subject: Re: Hash Surprises with Fixnum, #hash, and #eql? Date: Thu, 7 Apr 2011 11:06:39 -0500 Organization: Service de news de lacave.net Lines: 31 Message-ID: <86e862423ebca60a6258afe41401d989@ruby-forum.com> References: <4d9d372e$0$13393$afc38c87@news.optusnet.com.au> NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: talisker.lacave.net 1302192416 63162 65.111.164.187 (7 Apr 2011 16:06:56 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Thu, 7 Apr 2011 16:06:56 +0000 (UTC) In-Reply-To: X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 381132 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: <86e862423ebca60a6258afe41401d989@ruby-forum.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:2472 Phillip Gawlowski wrote in post #991471: >> If you see inheritance as "is a" relationship then inheritance would >> be Rational < Real < Complex but not the other way round. Otherwise >> you cannot use a subclass instance everywhere you were using a >> superclass instance. > > Though, does the "is a" relationship hold up? I think it's more of a > "kind of" relationship, where subsequent classes are defined in ever > more detail (so, you'd inherit Floats from Integers, and Complex from > Float). Isn't this the old "ellipse is_a circle, or vice versa" debate? If you make Circle the top class, then Ellipse reimplements pretty much everything (draw, area, etc); there's no useful code sharing. If you make Ellipse the top class, then Circle is just a special constrained case of Ellipse. Translating to the current discussion, substitute Float for Circle and Ellipse for Complex. Ruby's answer is: neither is a subclass of the other. Both inherit from Numeric. That is, Circle and Ellipse are both a Shape. Or in other words, "who cares"? Eventually you come to realise that a lot of what is taught in object oriented classes and textbooks is tosh :-) -- Posted via http://www.ruby-forum.com/.