Skip to content

Commit 9493948

Browse files
committed
role arguments can have constraints
1 parent c3ca435 commit 9493948

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/Language/typesystem.pod6

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,15 @@ X<|Type Capture (role)>L<Type captures|/type/Signature#Type_Captures> are suppor
373373
dd $c;
374374
# OUTPUT«C $c = C.new(a => "default")␤»
375375
376+
Arguments can have type constraints, C<where> clauses are not supported but can
377+
be achieved via C<subset>s.
378+
379+
class A {};
380+
class B {};
381+
subset A-or-B where * ~~ A|B;
382+
role R[A-or-B ::T] {};
383+
R[A.new].new;
384+
376385
=head3 Versioning and Authorship
377386
378387
Versioning and authorship can be applied via adverbs C«:ver<>» and C«:auth<>».

0 commit comments

Comments
 (0)