Metamodel::Versioning Reference
Metaobjects that support versioning
What it is #
role Metamodel::Versioning { ... }
Position in the hierarchy #
| Inherits from | — |
| Does | — |
| Consumed by | Metamodel::ClassHOW, Metamodel::ConcreteRoleHOW, Metamodel::ModuleHOW, Metamodel::NativeHOW, 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 ver #
method ver($obj)
Returns the version of the metaobject, if any, otherwise returns Mu.
method auth #
method auth($obj)
Returns the author of the metaobject, if any, otherwise returns an empty string.
method api #
method api($obj)
Returns the API of the metaobject, if any, otherwise returns an empty string.
method set_ver #
method set_ver($obj, $ver)
Sets the version of the metaobject.
method set_auth #
method set_auth($obj, $auth)
Sets the author of the metaobject.
method set_api #
method set_api($obj, $api)
Sets the API of the metaobject.
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.
2 ok
class Versioned:ver<0.0.1>:auth<github:Kaiepi>:api<1> { }
say Versioned.^ver; # OUTPUT: «v0.0.1»
say Versioned.^auth; # OUTPUT: «github:Kaiepi»
say Versioned.^api; # OUTPUT: «1»v0.0.1
github:Kaiepi
1
Documentation, Rakudo and Raku++ all agree.
BEGIN {
class Versioned { }
Versioned.^set_ver: v0.0.1;
Versioned.^set_auth: 'github:Kaiepi';
Versioned.^set_api: <1>;
}
say Versioned.^ver; # OUTPUT: «v0.0.1»
say Versioned.^auth; # OUTPUT: «github:Kaiepi»
say Versioned.^api; # OUTPUT: «1»v0.0.1
github:Kaiepi
1
Documentation, Rakudo and Raku++ all agree.