4 ms·
Funnily enough Rust supports exactly that pretty well with async. An `async {}` block is not evaluated, but converted into a generator/state machine that lives
by the_duke 2y ago
Funnily enough Rust supports exactly that pretty well with async.
An `async {}` block is not evaluated, but converted into a generator/state machine that lives on the stack, and that has to be advanced by calling a poll method. You can move it to the heap , but that does not happen automatically.
Sharing of values is obviously much more awkward due to mutability and no automatic cloning though.
- benreesman 2y agoI know how it works though I remain unconvinced that rustc is dealing with the same scope of problem as GHC in the general case. But to be clear, anyone with the username the_duke is probably really cool, and you clearly know your stuff as well as having style, so count me as a fan.