Index

This file was automatically generated from http://svn.pugscode.org/pugs/misc/old_pugs_perl5_backend/Perl6-MetaModel/docs/10_000_ft-view.pod on Thu Jul 12 12:23:24 2007 GMT, revision 16992.

10,000 ft view of the Perl6 MetaModel (2.0)


NAME

10,000 ft view of the Perl6 MetaModel (2.0)

DISCLAIMER

It should be noted that version 2.0 of the Metamodel is not yet complete, and is still missing some core features. However it currently does have the base elements needed to support those additional features. This document describes the current state of the metamodel, so it will change.

NOTATIONAL CONVENTIONS

    i(Foo)     - instance of Foo
    class(Foo) - the instance of Class named "Foo"

DESCRIPTION

Here is the basic layout of the metamodel 2.0 (in ASCII art).

            <user space>                  <meta space>
    -----------------------------------------------------------
                                  :  
          +---------------+       :  
          | i(Foo)        |       :  
          +---------------+       :  
          | class         |----+  :  
          | instance_data |    |  :    
          +---------------+    |  :    
                               |  :     
    +--------------------------+  :         
    |                             :  
    |     +---------------+       :     +---------------+     
    +---->| class(Foo)    |   +---:---->| class(Class)  |<---+
          +---------------+   |   :     +---------------+    |
          | class         |---+   :     | class         |----+
          +---------------+       :     +---------------+   
          | name          |       :     | name          |   
          | version       |       :     | version       |   
          | authority     |       :     | authority     |   
          | %methods      |       :     | %methods      |   
          | %attributes   |       :     | %attributes   |   
          | ...           |       :     | ...           |     
          +---------------+       :     +---------------+     
                                  :  

BOOTSTRAPPING

This is a rough description of the bootstrapping process. It follows the files which are loaded, and what those files do.

chaos.pl

This file contains all the primitive elements needed for the meta-model including global functions (WALKMETH, WALKCLASS, etc.), method generators, tagged attribute types, and opaque instance creators.

This is also where the Perl 5 magic exists to allow for "normal" method dispatching behavior.

gnosis.pl
This file creates a the basic class $::Class manually, and then adds the add_method function to it. This is the very first "object" in our system and after this is loaded, we can actually start using it as such.
metamorph.pl

This fills in the remaining methods in $::Class, each method giving $::Class more and more capabilities. It also then defines the attributes of $::Class.

Once this file is loaded, we have a fully formed class $::Class, however it is not over yet.

pneuma.pl
This file constructs $::Object using the same tools used in gnosis.pl and metamorph.pl.
genesis.pl

This file connects $::Class to $::Object by adding $::Object to $::Class's superclass list. We also manually populate the MRO's of both classes to avoid meta-circularity issues.

We now have a working object model, and at this point, the following things are true:

    class($::Class) is an instance of $::Class
    class($::Object) is an instance of $::Class
    $::Class is a subclass of $::Object

Or represented visually here:

    ---> is subclass of
    ...> is instance of

       class($::Class)
           :     ^
           :     :
           V     :
          $::Class ------+
              ^          |
              :          |
              :          |
      class($::Object)   |
              ^          |
              :          |
              :          |
         $::Object <-----+    
Perl6::MetaModel
This package loads all the other files above, and then provides what I am calling a "macro" layer to make class construction easier. This layer will likely be handled by the language parser in a real implementation, but is here purely for prototyping/testing convenience.

AUTHOR

This basically means that anything incorrect in here is my fault.

Stevan Little <stevan@iinteractive.com>