Permalink
Browse files

Document behaviour with degenerate cue intevals

- Could use less stilted language

Impl: rakudo/rakudo@df01ad9
Spec: perl6/roast@baa8ccb
Extra tests: rakudo/rakudo@031f8cf
  • Loading branch information...
zoffixznet committed Oct 18, 2017
1 parent 2bf7125 commit f7eefbd8902b44f98606e712d0de90e3e0a0e21c
Showing with 20 additions and 7 deletions.
  1. +8 −1 doc/Type/Promise.pod6
  2. +7 −2 doc/Type/Scheduler.pod6
  3. +5 −4 doc/Type/Supply.pod6
View
@@ -81,17 +81,24 @@ Creates a new Promise that will be kept in C<$seconds> seconds, or later.
).then: {$promise.result};
# OUTPUT: «timeout␤»
C<$seconds> can be fractional or negative. Negative values are treated as
C<0> (i.e. L<keeping|/routine/keep> the returned L<Promise> right away).
=head2 method at
method at(Promise:U: $at, :$scheduler = $*SCHEDULER --> Promise:D)
Creates a new Promise that will be kept at the given time, or later.
Creates a new C<Promise> that will be kept C<$at> the given time—which is
given as an L<Instant> or equivalent L<Numeric>—or as soon as possible after it.
my $p = Promise.at(now + 2).then({ say "2 seconds later" });
# do other stuff here
await $p; # wait here until the 2 seconds are over
If the given time is in the past, it will be treated as L<now> (i.e.
L<keeping|/routine/keep> the returned L<Promise> right away).
=head2 method allof
method allof(Promise:U: *@promises --> Promise:D)
View
@@ -34,10 +34,15 @@ how the code is run:
C<$at> can be an L<Instant|/type/Instant> before which the code won't be run.
Alternatively C<$in> is the number of seconds (possibly fractional) to wait
before running the code.
before running the code. If C<$at> is in the past or C<$in> is negative,
the delay is treated as zero. Implementations may equate to zero
very small values (e.g. lower than 0.001s) of C<$in> or result of
C<$at> - L<now>.
If C<$every> is specified, it is interpreted as the number of seconds
(possibly fractional) to wait before re-executing the code.
(possibly fractional) to wait before re-executing the code. Implementations
may treat too-small values as lowest resolution they support, possibly
warning in such situations; e.g. treating C<0.0001> as C<0.001>.
C<$times> tells the scheduler how many times to run the code.
View
@@ -280,10 +280,11 @@ phaser is usually a better choice.
method interval(Supply:U: $interval, $delay = 0, :$scheduler = $*SCHEDULER --> Supply:D)
Creates a supply that emits a value every C<$interval> seconds, starting
C<$delay> seconds from the call. The value is an integer, starting from 0,
and is incremented by one for each value emitted. Note that if the supplied
interval is less than one millisecond it will be changed to one millisecond
and a warning will be emitted.
C<$delay> seconds from the call. The emitted value is an integer, starting from
0, and is incremented by one for each value emitted.
Implementations may treat too-small values as lowest resolution they support,
possibly warning in such situations; e.g. treating C<0.0001> as C<0.001>.
=head2 method grep

0 comments on commit f7eefbd

Please sign in to comment.