Skip to content

Commit 3a0aa71

Browse files
committed
Add supply/emit to control structures
1 parent dc23d9f commit 3a0aa71

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/Language/control.pod6

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,22 @@ methods that are called from within C<gather>:
490490
491491
If values need to be mutable on the caller side, use L<take-rw|/type/Mu#routine_take-rw>.
492492
493+
=head1 X<supply/emit|control flow,supply emit>
494+
495+
Emits the invocant into the enclosing
496+
L<supply|/language/concurrency#index-entry-supply_(on-demand)>:
497+
498+
my $supply = supply {
499+
emit $_ for "foo", 42, .5;
500+
}
501+
$supply.tap: {
502+
say "received {.^name} ($_)";
503+
}
504+
505+
# OUTPUT:
506+
# received Str (foo)
507+
# received Int (42)
508+
# received Rat (0.5)
493509
494510
=head1 X<given|control flow, given>
495511
X<|switch (given)>

0 commit comments

Comments
 (0)