Skip to content

Commit cab78cb

Browse files
committed
doc parameters for roles
1 parent 39f4221 commit cab78cb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/Language/typesystem.pod6

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,13 @@ be achieved via C<subset>s.
563563
role R[A-or-B ::T] {};
564564
R[A.new].new;
565565
566+
Default parameters can be provided.
567+
568+
role R[$p = fail("Please provide a parameter to role R")] {};
569+
my $i = 1 does R;
570+
CATCH { default { say .^name, ': ', .Str} }
571+
# OUTPUT«X::AdHoc: Could not instantiate role 'R':␤Please provide a parameter to role R␤»
572+
566573
=head3 Versioning and Authorship
567574
568575
Versioning and authorship can be applied via adverbs X«C«:ver<>»|:ver<> (role)» and X«C«:auth<>»|:auth<> (role)».

0 commit comments

Comments
 (0)