Hi --

On Wed, 18 Nov 2009, Marnen Laibow-Koser wrote:

> David A. Black wrote:
>> On Tue, 17 Nov 2009, Marnen Laibow-Koser wrote:
>>
>>>>>
>>> http://www.ruby-doc.org/core-1.8.7/classes/Class.html
>> It says:
>>
>>    All metaclasses are instances of the class `Class'.
>>
>> but it does not say that all instances of Class are metaclasses :-)
>
> But I think that is what is meant.  How else does the diagram on that
> page make sense?  Every class has an associated metaclass of the same
> name in that diagram.  What is that if not the Class object?

The metaclasses are anonymous. The metaclass (or whatever we call it)
of String, for example, is a completely separate class/object from
String:

>> String.object_id
=> 1143790
>> class << String; object_id; end
=> 1143780

>> That would make "metaclass" a synonym for "class", which wouldn't make
>> sense.
>
> I think that "metaclass" is here a synonym for the Class object, as
> opposed to the class declaratio or anything else.

Class is itself an object (and a class). But it is definitely not the
metaclass/singleton class of any other object:

>> class << String; object_id; end
=> 1143780
>> Class.object_id
=> 1148540


David

-- 
THE COMPLEAT RUBYIST, Ruby training with Black/Brown/McAnally!
January 22-23, Tampa, Florida
Info and registration at http://www.thecompleatrubyist.com
--------------------------------------
My new job: http://tinyurl.com/yfpn9hz