Skip to content

Commit b982e3d

Browse files
committed
doc nextcallee
1 parent 5ad05a7 commit b982e3d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

doc/Language/functions.pod6

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,19 @@ sub run-it-again-and-again($x) {
781781
say power-it(5); # 625
782782
=end code
783783
784+
X<|nextcallee>
785+
Redispatch may be required to call a block that is not the current scope what
786+
provides C<nextsame> and friends with the problem to referring to the wrong
787+
scope. Use C<nextcallee> to capture the right candidate and call it at the
788+
desired time.
789+
790+
my \IOL = Lock.new;
791+
&say.wrap( -> |c {
792+
my &wrappee = nextcallee;
793+
IOL.protect: { &wrappee(|c) }
794+
});
795+
for ^100 { say "oops" }
796+
784797
=head1 Coercion Types
785798
786799
Coercion types can help you to have a specific type inside a routine, but

0 commit comments

Comments
 (0)