Skip to main content
Engineering LibreTexts

12.7: The Metaclass of Metaclass Is an Instance of Metaclass

  • Page ID
  • \( \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}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#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.

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

    The figure shows how all metaclasses are instances of Metaclass, including the metaclass of Metaclass itself. If you compare Figures 12.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 ProtoObject class, not Class. In Squeak, we must go one superclass higher to reach Class.)

    Code \(\PageIndex{1}\) (Squeak): The Class Hierarchy

    TranslucentColor superclass        →    Color
    Color superclass                   →    Object 

    Code \(\PageIndex{2}\) (Squeak): The Parallel Metaclass Hierarchy

    TranslucentColor class superclass                →    Color class
    Color class superclass                           →    Object class
    Object class superclass superclass               →    Class    "NB: skip ProtoObject class"
    Class superclass                                 →    ClassDescription
    ClassDescription superclass                      →    Behavior
    Behavior superclass                              →    Object

    Code \(\PageIndex{3}\) (Squeak): Instances of Metaclass

    TranslucentColor class class        →    Metaclass
    Color class class                   →    Metaclass
    Object class class                  →    Metaclass
    Behavior class class                →    Metaclass

    Code \(\PageIndex{4}\) (Squeak): Metaclass Class Is a Metaclass

    Metaclass class class        →    Metaclass
    Metaclass superclass         →    ClassDescription

    This page titled 12.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 Andrew P. Black, Stéphane Ducasse, Oscar Nierstrasz, Damien Pollet via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.