Warning: this role is part of the Rakudo implementation, and is not a part of the language specification.
Classes, roles and grammars can have attributes. Storage and introspection of attributes is implemented by this role.
Methods§
method add_attribute§
method add_attribute(, )
Adds an attribute. $attribute
must be an object that supports the methods name
, type
and package
, which are called without arguments. It can for example be of type Attribute.
method attributes§
method attributes()
Returns a list of attributes. For most Raku types, these will be objects of type Attribute.
method set_rw§
method set_rw()
Marks a type whose attributes default to having a write accessor. For example in
is rw
The is rw
trait on the class calls the set_rw
method on the metaclass, making all the attributes implicitly writable, so that you can write;
my = Point.new(x => 1, y => 2);.x = 42;
method rw§
method rw()
Returns a true value if method set_rw has been called on this object, that is, if new public attributes are writable by default.