Metamodel::RoleContainer Reference
Metaobject that supports holding/containing roles
What it is #
Position in the hierarchy #
| Inherits from | — |
| Does | — |
| Consumed by | Metamodel::ClassHOW, Metamodel::ConcreteRoleHOW, Metamodel::EnumHOW, Metamodel::ParametricRoleHOW |
Routines #
Signatures are reproduced from the documentation, including their declared return types. A routine listed here is part of the type's published interface; whether Raku++ implements it is a separate question, answered by the examples below.
method add_role #
method add_role($obj, Mu $role)
Adds the $role to the list of roles to be composed.
method roles_to_compose #
method roles_to_compose($obj --> List:D)
Returns List:D.
returns a list of roles added with add_role, which are to be composed at type composition time.
Examples, run three ways #
Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.
3 no-output
role Metamodel::RoleContainer {}Not executed: the documentation states no expected output for this example.
class A does SomeRole {}Not executed: the documentation states no expected output for this example.
class A {
BEGIN A.^add_role(SomeRole);
}Not executed: the documentation states no expected output for this example.