News for hackers. Stuff that matters.
Re:Async and Await in Rust: a full proposal by maxxxxx on Sunday July 15, 2018 @05:24PM (#17537163)
They are a real problem in desktop apps when you have to shut down the app gracefully. If you call an async function during shutdown you can't really tell when the async chain is done and you have nothing to wait for.

Just dealt with that in a .NET app that uses a 3rd party SDK that heavily uses async/wait. I had to build a whole layer of state management to just handle shutdowns. Simple threading would have been much easier.

It's different with server side code. There async/await is very nice.

Re:Async and Await in Rust: a full proposal by imtringued on Sunday July 15, 2018 @05:54PM (#17537302)
That just sounds like the API wasn't designed to support async/await rather than an inherent limitation. Something like Promise.all [1] is all you need to wait for multiple promises if the API had a way to accept a promise instead of a synchronous callback.

[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re:Async and Await in Rust: a full proposal by maxxxxx on Sunday July 15, 2018 @06:27PM (#17537436)
The same problem would happen with a promise. In a desktop the user clicks "Quit". If you now have to call an async function the Quit handler will return and somewhen later the await portion of the code gets called. From the Quit handler you can't tell when the await stuff has finished so there is no clear time when you can shut down the app.

In a browser on or server side it's different.