digitalmars.D - Difference between next() and then()? (package `future`)
- Victor Porton (2/2) Aug 16 2020 https://code.dlang.org/packages/future
- Timon Gehr (10/13) Aug 17 2020 Consider using the d.D.learn forum.
https://code.dlang.org/packages/future What is the difference between next() and then()
Aug 16 2020
On 17.08.20 04:57, Victor Porton wrote:https://code.dlang.org/packages/future What is the difference between next() and then()Consider using the d.D.learn forum. `then` is map and `next` is bind. I.e., Given a function from S to T, `then` maps a Future!S to a Future!T. Given a function from S to Future!T, `next` maps a Future!S to a Future!T. The implementation of next!f is then!f.sync: https://github.com/evenex/future/blob/master/source/future.d#L272 Where `sync` maps a Future!(Future!T) to a Future!T, by waiting for the outer and inner futures in turn: https://github.com/evenex/future/blob/master/source/future.d#L281
Aug 17 2020