|
|
|
|
|
by convolvatron
977 days ago
|
|
this I really found disconcerting - the model I often want is I want to start some work, and then join at some later point - or even chain directly into the next task. but instead I start a future, and then to run it at all I need to wait for the result. I understand the there are tools to effect this, but it really leaves you wondering - what did I just do? start an async task and then .. block on it in order to get it to execute? |
|
In JavaScript terms Futures are more like sugar around callbacks, they don't do anything until you call/poll them. Tasks are independent entities like Promises which are being run by the executor, though they may currently be blocked on other tasks.
> the model I often want is I want to start some work, and then join at some later point - or even chain directly into the next task.
Rust wants you to do this the other way around. First chain together your futures so that when you start the top level one as a task there is a single state machine for it to run.