From: Gary Wright Date: 2007-03-29T11:51:54+09:00 Subject: Re: Virtual classes and 'real' classes -- why? On Mar 28, 2007, at 4:42 PM, MenTaLguY wrote: > There is one slight difference in method lookup between class > objects and other objects, though. While for most objects, the > search order could be obtained via: > > class Object > def method_search_order > [ self.eigenclass ] + self.class.ancestors > end > end > > ...classes also include their ancestor classes' "eigenclasses" in > the search: > > class Class > def method_search_order > ancestors.select { |m| Class === m }.map { |c| c.eigenclass } > + self.class.ancestors > end > end I noticed that in 1.9 class eigenclasses are arranged in a superclass hierarchy but this is not reflected in the ancestors array. Is this intentional? class Object def eigenclass (class < p Array.eigenclass.ancestors # [Class, Module, Object, Kernel, BasicObject] p Class.eigenclass.ancestors # [Class, Module, Object, Kernel, BasicObject] klass = Class.eigenclass while klass p klass klass = klass.superclass end # output from loop # # # # Class Module Object BasicObject TypeError: uninitialized class It seems that BasicObject doesn't respond to #superclass.