From: Rick DeNatale Date: 2010-12-06T07:49:40+09:00 Subject: Re: Singleton class, metaclass, eigenclass: what do they mean? On Sun, Dec 5, 2010 at 4:24 PM, Peter Vandenabeele wrote: > On Sun, Dec 5, 2010 at 4:54 PM, Rick DeNatale wrote: >> There's a much simpler explanation IMHO. > ... > Thanks for the detailed explanation. > >> The 'things' pointed to by klass pointers are either: > > Could this be a typo where you intended to say 'super' pointers? I think I should have said klass or superclass pointers. > >> 1) class objects (like Array, Hash, Object etc)  if they are marked by >> a flag that they are 'virtual' then they are not returned by methods >> like class, superclass, ancestors, etc. > > From my findings: > > * the ancestors and the class method always hide it (as you write above) > * the 'superclass' method _does_ return the first singleton classes > pointed to by 'super' > > > $ irb > ruby-1.9.2-head > class A < Object; end >  => nil > ruby-1.9.2-head > A.singleton_class >  => # > ruby-1.9.2-head > A.singleton_class.superclass >  => # > > That's a diference between Ruby 1.9 and 1.8 in 1.8.7 class B < A end B.superclass # => A b_sing = class << B; self; end b_sing.superclass # => # -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale