Skip to content

Commit 8a2bc96

Browse files
committed
doc is required
1 parent cf3a79e commit 8a2bc96

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

doc/Language/typesystem.pod6

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,20 @@ public attributes of that class.
243243
my $c = C.new.a = 42;
244244
dd $c; # OUTPUT«Int $c = 42␤»
245245
246-
=head3 trait C<is required>
246+
=head3 X«trait C<is required>|is required»
247247
248-
TODO
248+
Defined as:
249+
250+
multi sub trait_mod:<is>(Attribute $attr, :$required!)
251+
252+
Marks a class or roles attribute as required. If the attribute is not
253+
initialized at object construction time throws
254+
L<X::Attribute::Required|/type/X::Attribute::Required>.
255+
256+
class C { has $.attr is required; }
257+
C.new;
258+
CATCH { default { say .^name => .Str } }
259+
# OUTPUT«X::Attribute::Required => The attribute '$!attr' is required, but you did not provide a value for it.␤»
249260
250261
=head3 trait C<does>
251262

0 commit comments

Comments
 (0)