Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum wrote:
Sorry, that should have been ->map(`[], 0) instead of ->transform(`[], 0, 0), otherwise failures are not propagated correctly...
Thanks for the heads up. Already figured that out earlier. I now have something like this:
private int allzero(mixed x) { return 0; }
//! 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()->timeout(seconds)->recover(allzero); on_failure(p->try_failure); return results(({this_program::this, p->future()}))->map(`[], 0); }
Which does not quite work yet. Still trying to wrap my head around it (with Promises that always is an issue since it requires a mindset shift).