@@ -19,9 +19,10 @@ combining promises, and waiting for results.
19
19
say $p.status; # OUTPUT: «Kept»
20
20
21
21
There are two typical scenarios for using promises. The first is to use a
22
- factory method (C < start > , C < in > , C < anyof > , C < allof > ) on the type object; those
23
- will make sure that the promise is automatically kept or broken for you, and
24
- you can't call C < break > or C < keep > on these promises yourself.
22
+ factory method (C < start > , C < in > , C < at > , C < anyof > , C < allof > , C < kept > , C < broken > )
23
+ on the type object; those will make sure that the promise is automatically kept
24
+ or broken for you, and you can't call C < break > or C < keep > on these promises
25
+ yourself.
25
26
26
27
The second is to create your promises yourself with C < Promise.new > . If you
27
28
want to ensure that only your code can keep or break the promise, you can use
@@ -99,6 +100,22 @@ given as an L<Instant> or equivalent L<Numeric>—or as soon as possible after i
99
100
If the given time is in the past, it will be treated as L < now > (i.e.
100
101
L < keeping|/routine/keep > the returned L < Promise > right away).
101
102
103
+ = head2 method kept
104
+
105
+ multi method kept(Promise:U: --> Promise:D)
106
+ multi method kept(Promise:U: \result --> Promise:D)
107
+
108
+ Returns a new promise that is already kept, either with the given value,
109
+ or with the default value True.
110
+
111
+ = head2 method broken
112
+
113
+ multi method broken(Promise:U: --> Promise:D)
114
+ multi method broken(Promise:U: \exception --> Promise:D)
115
+
116
+ Returns a new promise that is already broken, either with the given value,
117
+ or with the default value "Died".
118
+
102
119
= head2 method allof
103
120
104
121
method allof(Promise:U: *@promises --> Promise:D)
0 commit comments