From: Jim Weirich Date: 2005-04-19T20:36:00+09:00 Subject: Re: [EVALUATION] - E03c - The Ruby Object Model (Revised Documentation) On Tuesday 19 April 2005 06:39 am, Ilias Lazaridis wrote: > > Using _why's metaid library > > this library is irrelevant. > I'm evaluating standard ruby and its Object Model. > The [Meta] Object Model must be accessible without additional libraries. Accessing Object's metaclass: >> meta_class_of_Object = class << Object; self; end => # >> meta_class_of_Object.class => Class So, the metaclass of Object /does/ inherit from class. Now we demonstrate that the object in meta_class_of_Object is really the metaclass by defining a method on Object and finding the method added to its metaclass: >> meta_class_of_Object.instance_methods(false) => ["new", "allocate"] >> def Object.method_only_in_Object(); puts "HI"; end => nil >> meta_class_of_Object.instance_methods(false) => ["method_only_in_Object", "new", "allocate"] >> Object.method_only_in_Object HI => nil -- -- Jim Weirich jim@weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)