Skip to content

Commit e8d6d8d

Browse files
committed
doc is default on Attribute
1 parent 9e8e6fb commit e8d6d8d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/Type/Attribute.pod6

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@ The usual way to obtain an object of type C<Attribute> is by introspection:
3030
$a.set_value($instance, [1, 2, 3]);
3131
say $a.get_value($instance); # [1 2 3]
3232
33+
=head1 Traits
34+
35+
=head2 X<Trait is default|trait,is default (Attribute)>
36+
37+
An attribute that is assinged L<Nil|/type/Nil> will revert to its default value
38+
set with the trait C<is default>.
39+
40+
class C {
41+
has $.a is default(42) is rw = 666
42+
}
43+
my $c = C.new;
44+
say $c;
45+
$c.a = Nil;
46+
say $c;
47+
# OUTPUT«C.new(a => 666)␤C.new(a => 42)␤»
48+
3349
=head1 Methods
3450
3551
=head2 method name

0 commit comments

Comments
 (0)