//! Return a @[Future] that will be fulfilled with the fulfilled //! result of this @[Future], but not until at least @[seconds] have passed. this_program delay(int|float seconds) { Promise p = promise_factory(); on_failure(p->try_failure); return depend( ({ p->timeout(seconds)->recover(allzero) }) ); }
This is the simplest version I could come up with, part of the Promise class, not Future because I needed the depend() member. It properly short-circuits the call_out by propagating the failure case.
Anything I missed?
P.S. I'm left wondering if perhaps timeout_call_out_handle can be eliminated from the Future class by using a depend() and some separate (temporary) structure.