Hi Gary, I grateful for you helping me on this. (Though these things really confuses me:) Gary Wright wrote: >>Indeed if I from the singleton class does ObjectSpace.each_object >>(self) {|x| puts x} only my instance is printed. (I suspect > > 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. > My understanding of each_object is that it finds all instances of a supplied class (it accepts other types of arguments). So, to me, taken at face value the example supports the case that there is 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 would believe that b.class.superclass produces something like 'Object' as I would expect b.class to return an instance of the Class class. The Class class derives from Object. If I do: obj = 'Hello' objSingletonClass = class<< obj def foo puts 'This is the foo method printing' end self end puts objSingletonClass.superclass #-- I get : #<Class:String> Complete(0) #-- Kind regards!