In Functions§
See primary documentation in context for sub nextcallee
Redispatch may be required to call a block that is not the current scope what provides nextwith
and friends with the problem to referring to the wrong scope. Use nextcallee
to capture the right candidate and call it at the desired time.
proto pick-winner(|)multi pick-winner (Int \s)multi pick-winnerwith pick-winner ^5 .pick -> \result# OUTPUT:# And the winner is...# Woot! 3 won
The Int
candidate takes the nextcallee
and then fires up a Promise
to be executed in parallel, after some timeout, and then returns. We can't use nextsame
here, because it'd be trying to nextsame
the Promise's block instead of our original routine.
Note that, despite its name, the nextcallee
function is like:
callwith
/nextwith
, in that it takes parameterscallwith
/callsame
, in that it returns; the call tonextcallee
returns a reference, and the call to the reference also returns (unlikenextwith
/nextsame
, which don't return)