Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Jun 12, 2018
1 parent ddd101b commit f6df30a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions doc/Language/objects.pod6
Expand Up @@ -993,10 +993,16 @@ anonymous roles are supported.
Note that the object got the role mixed in, not the object's class or the
container. Thus, @-sigiled containers will require binding to make the role
stick as is shown in the example with C<@positional>. Some operators will return
a new value, which effectively strips the mixin from the result.
a new value, which effectively strips the mixin from the result. That is why it
might be more clear to mix in the role in the declaration of the variable using
C<does>:
The operator infix:<but> is narrower than the list constructor. When providing
a list of roles to mix in, always use parentheses.
role R {};
my @positional does R = <a b>;
say @positional.^name; # OUTPUT: «Array+{R}␤»
The operator C<infix:<but>> is narrower than the list constructor. When
providing a list of roles to mix in, always use parentheses.
=for code
role R1 { method m {} }
Expand Down

0 comments on commit f6df30a

Please sign in to comment.