On Feb 16, 2008, at 10:50 AM, UpsNDowns wrote: > * instance.class is a method like any other so it can be overriden > by the singleton, I think, so it can return whatever it wants. > Indeed if I from the singleton class does ObjectSpace.each_object > (self) {|x| puts x} only my instance is printed. (I suspect > ObjectSpace gets help from the VM/runtime). It can replace Object#klass, but it doesn't. Your ObjectSpace example is a good illustration of the singleton class/singleton object relationship models a class/instance relationship without actually being a class/instance relationship. > * Im not sure I understand what you mean by outside the hierachy. > My understanding is that the singleton is subclasses the original > class. class A; end class B < A; end a = A.new b = B.new S = (class <<a; self; end) # a's singleton class a.kind_of?(A) # true a.kind_of?(S) # true, as if S were a subclass of A but... B < A # true, B is a subclass of A S < A # nil, S is not a subclass of A b.class.superclass # A B.superclass # A S.superclass # A's Singleton Class, not A I'm not trying to say that the relationship is entirely different from a class/instance relationship just that they are not identical relationships. Gary Wright