David A. Black schrieb:

>
> You're three-deep here, though.  I thought you meant to disallow
> two-deep (singleton class of a singleton class).  (In my example I'm
> assuming that "def self.x" puts x into the singleton class of self,
> which is itself the singleton class of obj.)


Sorry for being  my confusing self::-)

>
> It then becomes a little confusing to call them "classes", since
> they're instances of something other than Class.  And it raises the
> whole subclassing Class problem....

Well that's the whole point they (singleton classes) are classes
but they are also very special kind  of classes. For normal objects
you would xpress this kind of relation ship by  sub classing.
For example, similar to


---
class Rodent; end
class Mouse < Rodent; end
jerry.instance_of?(Mouse) # true
jerry.instance_of?(Rodent) # false
jerry.kind_of?(Rodent)    # true
---

it would be

---
class Klass < Class; end #  we also have Klass ==  class << Class; self end

Jerry = class << self; self end
Jerry.instance_of?(Klass) # true
Jerry.instance_of?(Class) # false
Jerry.kind_of?(Class)   # true
----

The sub classing problem isn't all that bad because you could allow
sub classing Class exactly once (during the boot up of the object model).
Being a subclass and singleton of a class at the same time may sound
a bit confusing. On the hand, it also would emphasize the central role
of  Object, Class  (and possibly Klass) and the normal user would never
notice the difference.


/Christoph