4 ms·
> All this "futures" stuff strongly favors the main path over any other paths. You can't loop, retry, or easily branch on an error, other than bailing out. You
by pcwalton 10y ago
> All this "futures" stuff strongly favors the main path over any other paths. You can't loop, retry, or easily branch on an error, other than bailing out.
You can do all of that.
- Animats 10y agoOK, make an HTTP request, and if it fails, wait 2 seconds and retry. After 10 times, give up.
- pcwalton 10y agoTimeouts are covered here. http://alexcrichton.com/futures-rs/futures/index.html#examples http://alexcrichton.com/futures-rs/futures/index.html#exampl... As for repeating something multiple times, you would either repeat the chain 10 times or write your own future combinator. Probably writing a custom future combinator would make the most sense here; actually, such a thing ought to be built-in to futures.rs.
- Animats 10y agoThat's the problem - having to roll your own control structures. IF, WHILE, and FOR cover just about everything. This semi-functional style doesn't break down into a small number of simple, well-known primitives.