15.7: The Metaclass of Metaclass Is an Instance of Metaclass
- Page ID
- 43231
The final question to be answered is: what is the class of Metaclass class
? The answer is simple: it is a metaclass, so it must be an instance of Metaclass
, just like all the other metaclasses in the system (see Figure \(\PageIndex{1}\)).
Figure \(\PageIndex{1}\) shows how all metaclasses are instances of Metaclass
, including the metaclass of Metaclass
itself. If you compare Figures 15.6.1 and \(\PageIndex{1}\) you will see how the metaclass hierarchy perfectly mirrors the class hierarchy, all the way up to Object class
.
The following examples show us how we can query the class hierarchy to demonstrate that Figure \(\PageIndex{1}\) is correct. (Actually, you will see that we told a white lie — Object class superclass
\(\Rightarrow\) ProtoObject class
, not Class
. In Pharo, we must go one superclass higher to reach Class
.)
Collection superclass >>> Object
Collection class superclass >>> Object class Object class superclass superclass >>> Class "NB: skip ProtoObject class" Class superclass >>> ClassDescription ClassDescription superclass >>> Behavior Behavior superclass >>> Object
Collection class class >>> Metaclass Object class class >>> Metaclass Behavior class class >>> Metaclass
Metaclass class class >>> Metaclass Metaclass superclass >>> ClassDescription