From: Chris Pine Date: 2003-02-11T21:38:47+09:00 Subject: Re: Question about page 244 of the pickaxe... I really like replying to myself these days... ----- Original Message ----- Ruby really goes out of its way to prevent you from subclassing Class, though, which is what that would be. Why is this? Why have the singleton's super pointer point to another singleton class? I thought the problem with subclassing Class was that you didn't want a subclass of Class to be instantiated (since it would be like a class, but without Class as its superclass, or else it would be counterintuitive), but singleton classes can't be instantiated, so it wouldn't be a problem! ---------------------------- It looks to be coincidental. I think the reason the singleton's super pointer points to another singleton class is so that singleton methods can be inherited, too. For example, String.constants wouldn't work, since `constants' is defined in Module's singleton class, not String's. It feels like a pretty bizarre way to allow this sort of functionality (though I see no other way to do it). The treating of class objects and non-class objects so differently seems... artificial somehow. Like it was done only to allow inheritance of singleton methods. On the other hand, it has the "coincidental" side-effect of not allowing Class to be subclassed, which seems to me like a deeper, more fundamental facet of Ruby than I had previously given it credit for. Is there some principle behind this? Chris