Skip to content

Commit 280c3c4

Browse files
committed
document set_rw
1 parent 0e44c0c commit 280c3c4

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lib/Type/Metamodel/AttributeContainer.pod

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,27 @@ It can for example be of L<type Attribute|/type/Attribute>.
2626
Returns a list of attributes. For most Perl 6 types, these will be objects of
2727
L<type Attribute|/type/Attribute>.
2828
29+
=head2 method set_rw
30+
31+
method set_rw(Metamodel::AttributeContainer: $obj)
32+
33+
Marks a type whose attributes default to having a write accessor. For example
34+
in
35+
36+
class Point is rw {
37+
has $.x;
38+
has $.y;
39+
}
40+
41+
The C<is rw> trait on the class calls the C<set_rw> method on the meta class,
42+
making all the attributes implicitly writable, so that you can write;
43+
44+
my $p = Point.new(x => 1, y => 2);
45+
$p.x = 42;
46+
2947
=begin comment
3048
31-
TODO: compose_attributes, set_rw, rw, get_attribute_for_usage
49+
TODO: compose_attributes, rw, get_attribute_for_usage
3250
3351
Also TODO: desribe :local, :excl, :all options of method attributes
3452

0 commit comments

Comments
 (0)