role Metamodel::Versioning { ... }
Metamodel role for (optionally) versioning metaobjects.
When you declare a type, you can pass it a version, author, and/or API and get them, like so:
class Versioned:ver<0.0.1>:auth<github:Kaiepi>:api<1> { }
say Versioned.^ver;
say Versioned.^auth;
say Versioned.^api;
This is roughly equivalent to the following, which also sets them explicitly:
BEGIN {
class Versioned { }
Versioned.^set_ver: v0.0.1;
Versioned.^set_auth: 'github:Kaiepi';
Versioned.^set_api: <1>;
}
say Versioned.^ver;
say Versioned.^auth;
say Versioned.^api;
method ver($obj)
Returns the version of the metaobject, if any, otherwise returns Mu.
method auth($obj)
Returns the author of the metaobject, if any, otherwise returns an empty string.
method api($obj)
Returns the API of the metaobject, if any, otherwise returns an empty string.
method set_ver($obj, $ver)
Sets the version of the metaobject.
method set_auth($obj, $auth)
Sets the author of the metaobject.
method set_api($obj, $api)
Sets the API of the metaobject.