Skip to content

Commit d6b162b

Browse files
committed
Document that "is required($reason)" is also possible
1 parent 4aaa191 commit d6b162b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/Type/Attribute.pod6

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ error.
6262
CATCH{ default { say .^name, ': ', .Str } }
6363
# OUTPUT: «X::Attribute::Required: The attribute '$!a' is required, but you did not provide a value for it.␤»
6464
65+
You can also specify a reason why the attribute is required:
66+
67+
class D {
68+
has $.a is required("it is a good idea");
69+
}
70+
my $d = D.new;
71+
CATCH{ default { say .^name, ': ', .Str } }
72+
# OUTPUT: «X::Attribute::Required: The attribute '$!a' is required because it is a good idea,␤but you did not provide a value for it.␤»
73+
6574
=head2 X<trait is DEPRECATED|trait,is DEPRECATED (Attribute)>
6675
6776
multi sub trait_mod:<is>(Attribute:D $r, :$DEPRECATED!)

0 commit comments

Comments
 (0)