On Thu, 5 May 2005, Joel VanderWerf wrote:

> Ara.T.Howard / noaa.gov wrote:
>
>> not bad!  why do you suppose metaclasses don't have themselves as
>> ancestors?
>> or perhaps put a better way - why DO normal classes?
>
> Mebbe because #ancestors shows the path that method lookup will follow,
> _after_ checking for a singleton method.
>
> irb(main):001:0> class << String; p ancestors; end
> [Class, Module, Object, Kernel]
> => nil
>
> There's no need to list the "metaclass" of String in the above, because
> method lookup always starts with that object, if it exists, in case a
> singleton method has been defined.
>
> irb(main):002:0> class String; p ancestors; end
> [String, Enumerable, Comparable, Object, Kernel]
> => nil
>
> In this case, method lookup starts with the singleton class of the given
> string (if one has been created), and then looks in the instance methods
> of String, Enumerable, etc.

makes sense.  bad name then.  should be Class#search_path or someting...

cheers.

-a
-- 
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| renunciation is not getting rid of the things of this world, but accepting
| that they pass away. --aitken roshi
===============================================================================