Skip to content

Commit 2a71ddf

Browse files
authored
Merge pull request #4630 from schultzdavid/patch-3
In `operators.rakudoc#infix_.=`, clarify usage of infix & postfix operator, and add link
2 parents 2b85fdf + b7bf95d commit 2a71ddf

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/Language/operators.rakudoc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,16 +1282,17 @@ surrounding whitespace (before and/or after) to distinguish them.
12821282
Calls the right-side method on the value in the left-side container,
12831283
replacing the resulting value in the left-side container.
12841284

1285-
In most cases, this behaves identically to the postfix mutator, but the
1286-
precedence is lower:
1285+
In most cases, this behaves identically to postfix L<C<.=>|#methodop_.=>,
1286+
but the precedence is lower:
12871287

12881288
=for code
12891289
my $a = -5;
1290-
say ++$a.=abs;
1290+
say ++$a.=abs; # with postfix mutator; equivalent to ++($a.=abs)
12911291
# OUTPUT: «6␤»
12921292
=for code :skip-test<illustrates error>
1293-
say ++$a .= abs;
1294-
# OUTPUT: «Cannot modify an immutable Int␤
1293+
my $a = -5;
1294+
say ++$a .= abs; # with infix mutator; evaluated as -4 .= abs
1295+
# OUTPUT: «Cannot modify an immutable Int (-4)␤
12951296
# in block <unit> at <tmp> line 1␤␤»
12961297

12971298
=head2 infix C«.»

0 commit comments

Comments
 (0)