From: Rick DeNatale Date: 2009-05-08T03:26:05+09:00 Subject: Re: Superclass of eigenclass On Thu, May 7, 2009 at 1:17 PM, Danny O cuiv wrote: > > The ordinary object is not an instance of the eigenclass. In your > example, the ordinary object is an instance of TestClass, not of any > eigenclass. Well instance is one of those things which the smoke and mirrors in MRI makes muddy. Another example is superclass. One definition is that a is a superclass of b if the superclass slot of b points to a. This is the sense that the superclass of a class'es eigenclass is the eigenclass of the classes superclass. But if you define superclass as what gets returned by the superclass method, then MRI obscures the truth: String.eigenclass # => # Object.eigenclass # => # String.superclass # => Object String.eigenclass.superclass # => # If you go in and look at the implementation, you'll find that the eigenclass of String has a superclass slot which points to the eigenclass of Object, but the superclass method implementation skips past 'singleton' classes, until it gets to Now the instance_of? method does the same thing, it skips over 'singleton' classes. So what I'm really talking about is that a singleton class of an ordinary object has a singleton instance, which is the only meaning of singleton class which ever made sense to me. > Indeed, there would be a bootstrapping problem if you > regarded the ordinary object as an instance of the eigenclass. (You can > only have an eigenclass in the context of an existing object, so you > couldn't have created that object in the first place by instantiating > the eigenclass.) That's only if you tie the notion of instantiation and instance too closely, I don't see it that way. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale