Skip to content

Commit e29f3ad

Browse files
committed
Remove direct params from winner ... {}
That list should be automagically created from whatever was specified with the done $foo { } statements
1 parent 0eedbb4 commit e29f3ad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

S17-concurrency.pod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ result.
375375
This simply calls C<result> on each of the C<Promise>s, so any exception will
376376
be thrown. There is also a C<winner> statement [keywords still negotiable]:
377377

378-
winner $p1, $p2 {
378+
winner {
379379
done $p1 { say "First promise got a value" }
380380
done $p2 { say "Second promise got a value" }
381381
}
@@ -385,7 +385,7 @@ result, either kept or broken. In order to avoid blocking, it is possible to
385385
provide a closure with the C<nobody> keyword, that will be invoked if none of
386386
the promises currently have a result available.
387387

388-
winner $p1, $p2 {
388+
winner {
389389
done $p1 { say "First promise got a value" }
390390
done $p2 { say "Second promise got a value" }
391391
nobody { say "Not done yet" }
@@ -399,8 +399,8 @@ to represent any of them). The index and promise are passed to the
399399
code as named arguments C<$:v> and <$:k> (possibly via priming if
400400
the code is instantiated ahead of time).
401401

402-
winner @promises {
403-
done * { say "Promise $:k was kept, result was: ", $:v.result }
402+
winner {
403+
done @promises { say "Promise $:k was kept, result was: ", $:v.result }
404404
}
405405

406406
In this case C<$:k> returns the index of the promise, base 0.

0 commit comments

Comments
 (0)