Metamodel::Documenting Reference
Metarole for documenting types.
What it is #
Position in the hierarchy #
| Inherits from | — |
| Does | — |
| Consumed by | Metamodel::ClassHOW, Metamodel::DefiniteHOW, Metamodel::ModuleHOW, Metamodel::NativeHOW, Metamodel::PackageHOW, Metamodel::ParametricRoleHOW, Metamodel::SubsetHOW |
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 set_why #
method set_why($why)
Sets the documentation for a type to $why.
method WHY #
method WHY()
Returns the documentation for a type.
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::Documenting { }Not executed: the documentation states no expected output for this example.
#|[Documented is an example class for Metamodel::Documenting's documentation.]
class Documented { }
#=[Take a look at my WHY!]
say Documented.WHY;
# OUTPUT:
# Documented is an example class for Metamodel::Documenting's documentation.
# Take a look at my WHY!Not executed: the documentation states no expected output for this example.
BEGIN {
our Mu constant Documented = Metamodel::ClassHOW.new_type: :name<Documented>;
Documented.HOW.compose: Documented;
Documented.HOW.set_why: do {
my Pod::Block::Declarator:D $pod .= new;
$pod._add_leading: "Documented is an example class for Metamodel::Documenting's documentation.";
$pod._add_trailing: "Take a look at my WHY!";
$pod
};
}
say Documented.HOW.WHY;
# OUTPUT:
# Documented is an example class for Metamodel::Documenting's documentation.
# Take a look at my WHY!Not executed: the documentation states no expected output for this example.