From: Robert Dober Date: 2006-10-03T01:07:18+09:00 Subject: Re: Why can't I get on Top? ------=_Part_49472_23525785.1159805234987 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/2/06, dblack@wobblini.net wrote: > > Hi -- > > On Mon, 2 Oct 2006, Robert Dober wrote: > > > On 10/2/06, dblack@wobblini.net wrote: > >> > >> Hi -- > >> > >> > >> class C; end > >> class D < C; end > >> > >> d = D.new > >> sing = class << d; self; end > >> > >> p D.new.instance_of?(C) # false > >> p D.new.instance_of?(D) # true > >> p D.new.instance_of?(sing) # false > >> > >> So thinking of the singleton class as a subclass of the object's class > >> might be a little misleading, since the object still relates to its > >> "birth class" at only one level of remove. > > > > > > Of course, but what I am puzzeled about is, why you use #instance_of?, > well > > not really, because that was how the argument began. > > As a matter of fact let me be more humble ;) > > I am afraid I missed something basic in the discussion, because to my > > understanding #instance_of? is irrelevant and #is_a? > > is what we are interested in, no? (obviously no ;). > > I was responding to Timothy's description of the default object main > as an instance of its singleton class. Yes I pointed that out... My point was that the > relationship between an object and its singleton class is not actually > defined by Ruby as a class-instance relationship, though of course it > is very similar to such a relationship in many ways. ... but I got confused with the original concept, I did not realize that you drifted OT, which is not a bad thing. Your clarifications will save me some time as I was intrigued in which way the instance_of_ness of the main object would be relevant, and I guess it is not. Thx Robert David > > -- > David A. Black | dblack@wobblini.net > Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] > DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] > [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com > [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org > > ------=_Part_49472_23525785.1159805234987--