Skip to content

Commit f6df30a

Browse files
committed
1 parent ddd101b commit f6df30a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

doc/Language/objects.pod6

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -993,10 +993,16 @@ anonymous roles are supported.
993993
Note that the object got the role mixed in, not the object's class or the
994994
container. Thus, @-sigiled containers will require binding to make the role
995995
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>:
997999
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.
10001006
10011007
=for code
10021008
role R1 { method m {} }

0 commit comments

Comments
 (0)