File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -993,10 +993,16 @@ anonymous roles are supported.
993
993
Note that the object got the role mixed in, not the object's class or the
994
994
container. Thus, @-sigiled containers will require binding to make the role
995
995
stick as is shown in the example with C < @positional > . Some operators will return
996
- a new value, which effectively strips the mixin from the result.
996
+ a new value, which effectively strips the mixin from the result. That is why it
997
+ might be more clear to mix in the role in the declaration of the variable using
998
+ C < does > :
997
999
998
- The operator infix:<but> is narrower than the list constructor. When providing
999
- a list of roles to mix in, always use parentheses.
1000
+ role R {};
1001
+ my @positional does R = <a b>;
1002
+ say @positional.^name; # OUTPUT: «Array+{R}»
1003
+
1004
+ The operator C < infix:<but> > is narrower than the list constructor. When
1005
+ providing a list of roles to mix in, always use parentheses.
1000
1006
1001
1007
= for code
1002
1008
role R1 { method m {} }
You can’t perform that action at this time.
0 commit comments