Rakudo Meta-Object API
This document describes the meta-objects that constitute Rakudo's objects implementation. It also describes the API to implement should you wish to introduce your own meta-objects.
Meta-model Organization
Rakudo is built on top of the NQP platform. NQP provides an object model core that is often known as "6model". It is inspired by the needs of Perl 6, but actually provides a very minimal base that other languages can build their own meta-objects on top of.
While Rakudo could start from these base primitives, instead it makes use of some of the NQP meta-objects. Out of the box 6model provides no concept of classes or roles. NQP's meta-objects include a simple, non-parametric implementation of roles and a simple but capable implementation of classes. These are put to use in writing Rakudo's meta-objects.
The Rakudo meta-objects are generally factored in terms of roles. These are composed into classes that represent the various types of Perl 6 package (such as classes and roles).
Roles
The following roles exist and provide re-usable pieces of functionality that can be re-used in various places in the meta-model.
MethodContainer
This role provides storage of methods, method addition and method introspection.
MultiMethodContainer
This role provides the extra pieces needed for multi-method handling.
AttributeContainer
This role provides storage of attributes, attribute addition and attribute introspection.
RoleContainer
This role provides storage of roles, role addition and role introspection. The composition process is not part of the functionality provided by this role, however.
MultipleInheritance
Provides for addition of multiple parents, and introspection of them too.
C3MRO
This role provides an implementation of the C3 method resolution order.
Versioning
This role provides storage and introspection of a version and authority.
Classes
The following classes exist in the Perl 6 meta-model.
ModuleHOW
Provides an implementation of modules.
ClassHOW
Provides an implementation of classes.
ParametricRoleHOW
Provides an implementation of parametric roles, which may be instantiated.
ConcreteRoleHOW
Provides an implementation of a concrete instance of a role.
GrammarHOW
Provides an implementation of grammars. Actually, just a subclass of the ClassHOW since grammars are really just slightly specialized classes.
NativeHOW
Meta-object for a native type (only accesible via the type object, perhaps).
SubsetHOW
Provides an implementation of subset types.
Attribute
Represents an attribute.
RoleToClassComposer
Composes a single role into a class. (If many roles are specified, it makes a single role that does all of the roles the class wishes to, and then composes that single role).
RoleToRoleComposer
Composes one or more roles into another role, creating a kind of role "summation".
RoleToObjectComposer
Compoes a role into an object - essentially doing a mix-in.