From: Danny O cuiv Date: 2009-05-12T23:38:50+09:00 Subject: Re: Superclass of eigenclass Robert Dober wrote: > the super class of a singleton class is very well defined as the > class of the singleton's class object's class. Robert, I mustn't be making myself clear. I fully agree with your statement above. Because the language can get a bit dense, it's probably clearer to adopt a notation (as I did before) of a class called X, an instance of X called x and the eigenclass of x called e. The superclass of e is (as you say) the eigenclass of X (i.e. #). The superclass of this is the eigenclass of class Class (i.e. #). No problem with this whatsoever. I wouldn't go so far as to say it's well-defined, because it was different in 1.8.2 and in some versions of 1.9, but that's a separate issue which we can leave to one side. However, what is clear from the above is that X is not a superclass of e. This is a problem for two reasons: (i) Certain metaprogramming techniques (e.g the one on page 295 or RPL) involve calling super in an eigenclass method, with the intention of picking up the implementation of the same method in the original class. If X is not a superclass of e, this shouldn't work. But it does. (ii) Calling the ancestors on e gives: e.ancestors # => [X, Object, Kernel] So we have X appearing as an ancestor of e, when it is neither a superclass of e nor an included class in e. Somebody here must have a better handle on this than me. Please chip in if you do. Thanks, Danny. -- Posted via http://www.ruby-forum.com/.