File: metaobject-api.pod

package info (click to toggle)
rakudo 2014.07-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,828 kB
  • ctags: 1,299
  • sloc: perl: 22,640; ansic: 2,689; java: 1,686; sh: 17; makefile: 14
file content (115 lines) | stat: -rw-r--r-- 3,122 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
=head1 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.


=head2 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).


=head2 Roles

The following roles exist and provide re-usable pieces of functionality
that can be re-used in various places in the meta-model.

=head3 MethodContainer

This role provides storage of methods, method addition and method
introspection.

=head3 MultiMethodContainer

This role provides the extra pieces needed for multi-method handling.

=head3 AttributeContainer

This role provides storage of attributes, attribute addition and attribute
introspection.

=head3 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.

=head3 MultipleInheritance

Provides for addition of multiple parents, and introspection of them too.

=head3 C3MRO

This role provides an implementation of the C3 method resolution order.

=head3 Versioning

This role provides storage and introspection of a version and authority.


=head2 Classes

The following classes exist in the Perl 6 meta-model.

=head3 ModuleHOW

Provides an implementation of modules.

=head3 ClassHOW

Provides an implementation of classes.

=head3 ParametricRoleHOW

Provides an implementation of parametric roles, which may be instantiated.

=head3 ConcreteRoleHOW

Provides an implementation of a concrete instance of a role.

=head3 GrammarHOW

Provides an implementation of grammars. Actually, just a subclass of the
ClassHOW since grammars are really just slightly specialized classes.

=head3 NativeHOW

Meta-object for a native type (only accesible via the type object, perhaps).

=head3 SubsetHOW

Provides an implementation of subset types.

=head3 Attribute

Represents an attribute.

=head3 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).

=head3 RoleToRoleComposer

Composes one or more roles into another role, creating a kind of role
"summation".

=head3 RoleToObjectComposer

Compoes a role into an object - essentially doing a mix-in.