@@ -1324,6 +1324,10 @@ my $supply = supply {
13241324$supply.tap( -> $v { say "First : $v" });
13251325=end code
13261326
1327+ C<emit> is implemented as a L<control exception|/language/phasers#CONTROL> and
1328+ can therefore be used by something called from the C<supply> block that it
1329+ refers to.
1330+
13271331See also L<the page for C<emit> methods|/routine/emit>.
13281332
13291333=head2 sub undefine
@@ -1459,24 +1463,30 @@ of any subsequent calls to C<exit> in the same, or any other thread.
14591463 sub done(--> Nil)
14601464
14611465If used outside any supply or react block, throws an exception C<done without
1462- supply or react>. Within a L<C<Supply>|/type/Supply> block, it will indicate the
1463- supply will no longer emit anything. See also L<documentation on method
1464- C<done>|/routine/done>.
1466+ supply or react>. Within a L<C<Supply>|/type/Supply> block, it will signal that
1467+ the supply will not emit further values, and leaves the supply block. See also
1468+ L<documentation on method C<done>|/routine/done>.
1469+
1470+ C<done> is implemented as a L<control exception|/language/phasers#CONTROL> and
1471+ can therefore be used by something called from the C<supply> or C<react> block
1472+ that it refers to.
14651473
14661474=for code
14671475my $supply = supply {
14681476 for 1 .. 3 {
14691477 emit($_);
14701478 }
14711479 done;
1480+ say "never reached";
14721481}
14731482$supply.tap( -> $v { say "Second : $v" }, done => { say "No more" });
14741483# OUTPUT: «Second : 1Second : 2Second : 3No More»
14751484
1476- The block passed to the C<done> named argument will be run when C<done> is
1477- called within the C<supply> block.
1485+ The block passed to the C<done> named argument when tapping the supply will be
1486+ run when C<done> is called within the C<supply> block. Similarly, C<whenever>
1487+ blocks that were used to tap the supply will have any C<LAST> phasers called.
14781488
1479- As of the 2021.06 release of the Rakudo compiler, it is also possibly to
1489+ As of the 2021.06 release of the Rakudo compiler, it is also possible to
14801490supply a value with C<done>:
14811491
14821492 sub done($value --> Nil)
0 commit comments