News for hackers. Stuff that matters.
Re:How Rust optimizes async/await by pcwalton on Monday August 19, 2019 @01:24PM (#20739705)
Because most people don't like writing state machines by hand.
Re:How Rust optimizes async/await by rapsey on Monday August 19, 2019 @01:35PM (#20739810)
Pre-await Tokio code looks way worse to me.
Re:How Rust optimizes async/await by jcranmer on Monday August 19, 2019 @03:08PM (#20740770)
A lot of that, I suspect, is that Rust's borrow checker makes specifying ownership correctly for callback chains extremely painful and unergonomic.

In my experience, closure-based async programming is only sufficiently painless in managed languages to be worth using. When you're dealing with manual memory management (or, rather, smart pointer memory management), you spend a lot more time trying to make the captures hold onto stuff.

Re:How Rust optimizes async/await by tmandry on Monday August 19, 2019 @03:50PM (#20741165)
I'd agree with this, and emphasize the point that this stuff is really tricky to get right without GC. Fighting the borrow checker is somewhat expected when you're dealing with this level of inherent complexity in your memory management.

One of the key reasons for shipping async/await is that it erases almost all of this difficulty and lets you write straight-line code again.