role Metamodel::Versioning

Metaobjects that support versioning
role Metamodel::Versioning { ... }

Warning: this role is part of the Rakudo implementation, and is not a part of the language specification.

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;  # OUTPUT: Ā«v0.0.1ā¤Ā»
say Versioned.^auth; # OUTPUT: Ā«github:Kaiepiā¤Ā»
say Versioned.^api;  # OUTPUT: Ā«1ā¤Ā»

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;  # OUTPUT: Ā«v0.0.1ā¤Ā»
say Versioned.^auth; # OUTPUT: Ā«github:Kaiepiā¤Ā»
say Versioned.^api;  # OUTPUT: Ā«1ā¤Ā»

Methods

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.

See Also

role Metamodel::AttributeContainer

Metaobject that can hold attributes

role Metamodel::C3MRO

Metaobject that supports the C3 method resolution order

role Metamodel::Documenting

Metarole for documenting types.

role Metamodel::Finalization

Metaobject supporting object finalization

role Metamodel::MethodContainer

Metaobject that supports storing and introspecting methods

role Metamodel::Mixins

Metaobject for generating mixins

role Metamodel::MROBasedMethodDispatch

Metaobject that supports resolving inherited methods

role Metamodel::MultipleInheritance

Metaobject that supports multiple inheritance

role Metamodel::Naming

Metaobject that supports named types

role Metamodel::ParametricRoleGroupHOW

Represents a group of roles with different parameterizations

role Metamodel::ParametricRoleHOW

Represents a non-instantiated, parameterized, role.

role Metamodel::PrivateMethodContainer

Metaobject that supports private methods

role Metamodel::RoleContainer

Metaobject that supports holding/containing roles

role Metamodel::RolePunning

Metaobject that supports punning of roles.

role Metamodel::Stashing

Metarole for type stashes

role Metamodel::Trusting

Metaobject that supports trust relations between types

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.