From: Rick DeNatale Date: 2009-05-08T00:50:25+09:00 Subject: Re: Superclass of eigenclass On Thu, May 7, 2009 at 8:35 AM, Danny O cuiv wrote: > On page 261 of The Ruby Programming Language, they state: > > "Class objects are special: they have superclasses. The eigenclasses of > class objects are also special: they have superclasses, too. The > eigenclass of an ordinary object stands alone and has no superclass." I'm pretty sure that this is a typo. Eigenclasses of ordinary objects certainly do have superclasses, that's how methods not defined in the singleton class sent to the ordinary object get resolved. Two things that the eigenclass of an ordinary object can't have that and eigenclass of a class (which I for one prefer to call a metaclass) can have is: 1. A subclass 2. Any instances besides that singleton ordinary object, which is why you get an exception of you try to send new to such an eigenclass. I've long maintained that Ruby would be quite a bit clearer if we cleaned up this singleton vs. eigen vs. meta class thing. The fact that MRI uses a single flag bit marked singleton for both singleton classes and metaclasses, an implementation artifact which is pretty much hidden by the internal implementation of methods like class, ancestors etc. just tends to confuse people. But that's just my opinion. -- 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