Skip to content

Commit ce68a6d

Browse files
committed
Clarifies done and quit callbacks on taps
Clarifies what triggers &done and &quit callbacks to be called on a tap object.
1 parent b7847a5 commit ce68a6d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

doc/Type/Supply.pod6

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ It is a thread-safe implementation of the
1414
L<Observer Pattern|https://en.wikipedia.org/wiki/Observer_pattern>,
1515
and central to supporting reactive programming in Perl 6.
1616
17-
1817
There are two types of Supplies: C<live> and C<on demand>. When tapping into a
1918
C<live> supply, the tap will only see values that are flowing through the
2019
supply B<after> the tap has been created. Such supplies are normally infinite
@@ -29,7 +28,7 @@ time it is tapped. If the tap is closed, the timer simply stops emitting values
2928
to that tap.
3029
3130
A C<live> C<Supply> is obtained from the L<Supplier|/type/Supplier>
32-
factory method C<Supply>. New values are emitted by calling C<emit> on
31+
factory method C<Supply>. New values are emitted by calling C<emit> on
3332
the C<Supplier> object.
3433
3534
my $supplier = Supplier.new;
@@ -60,13 +59,9 @@ Creates a new tap (a kind of subscription if you will), in addition to all
6059
existing taps. The first positional argument is a piece of code that will be
6160
called when a new value becomes available through the C<emit> call.
6261
63-
The C<&done> callback is called when the C<done> method on the supply is
64-
called, indicating the end of life of the channel. For a C<live> supply the
65-
C<done> routine will be called on the parent C<Supplier>.
62+
The C<&done> callback can be called in a number of cases: if a supply block is being tapped, when a C<done> routine is reached; if a supply block is being tapped, it will be automatically triggered if the supply block reaches the end; if the C<&done> method is called on the parent C<Supplier> (in the case of a supply block, if there are multiple Suppliers referenced by C<whenever>, they must all have their C<done> method invoked for this to trigger the C<&done> callback of the tap).
6663
67-
The C<&quit> callback is called when the C<quit> method on the supply is
68-
called, indicating an erroneous termination of the supply. For a C<live>
69-
supply the C<quit> routine will be called on the parent C<Supplier>
64+
The C<&quit> callback is called if the tap is on a supply block which exits with an error. It is also called if the C<quit> method is invoked on the parent C<Supplier> (in the case of a supply block any one C<Supplier> quitting with an uncaught exception will call the C<&quit> callback as the block will exit with an error).
7065
7166
Method C<tap> returns an object of type L<Tap|/type/Tap>, on which you can
7267
call the C<close> method to cancel the subscription.

0 commit comments

Comments
 (0)