On Sun, Dec 5, 2010 at 4:24 PM, Peter Vandenabeele
<peter / vandenabeele.com> wrote:
> On Sun, Dec 5, 2010 at 4:54 PM, Rick DeNatale <rick.denatale / gmail.com> w=
rote:
>> 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) =A0if 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'
>
> <code>
> $ irb
> ruby-1.9.2-head > class A < Object; end
> =A0=3D> nil
> ruby-1.9.2-head > A.singleton_class
> =A0=3D> #<Class:A>
> ruby-1.9.2-head > A.singleton_class.superclass
> =A0=3D> #<Class:Object>
> </code>
>

That's a diference between Ruby 1.9 and 1.8  in 1.8.7

class B < A
end

B.superclass # =3D> A
b_sing =3D class << B; self; end

b_sing.superclass # =3D> #<Class:Class>

--=20
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