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 <<self; self; end) end end p Array.eigenclass.superclass # #<Class:Object> 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:Class> #<Class:Module> #<Class:Object> #<Class:BasicObject> Class Module Object BasicObject TypeError: uninitialized class It seems that BasicObject doesn't respond to #superclass.