trait is rw (Attribute)

Documentation for trait is rw (Attribute) assembled from the following types:

class Attribute

From Attribute

(Attribute) trait is rw (Attribute)

Defined as:

multi sub trait_mod:<is> (Attribute:D $attr:$rw!)

Marks an attribute as read/write as opposed to the default readonly. The default accessor for the attribute will return a writable value.

class Boo {
   has $.bar is rw;
   has $.baz;
};
 
my $boo = Boo.new;
$boo.bar = 42# works 
$boo.baz = 42;
CATCH { default { put .^name''.Str } };
# OUTPUT: «X::Assignment::RO: Cannot modify an immutable Any␤»