Skip to main content
Engineering LibreTexts

15.7: The Metaclass of Metaclass Is an Instance of Metaclass

  • Page ID
    43231
    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    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}\)).

    All metaclasses are instances of the class Metaclass.
    Figure \(\PageIndex{1}\): All metaclasses are instances of the class Metaclass, even the metaclass of Metaclass.

    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
    

    This page titled 15.7: The Metaclass of Metaclass Is an Instance of Metaclass is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.