News for hackers. Stuff that matters.
Re:Async Cancellation by keewee7 on Friday November 12, 2021 @01:54AM (#29196931)
How does the async/await story in Rust compare with C#?

In C# it feels 95% done and the remaining 5% can lead to some significant confusion.

Re:Async Cancellation by GolDDranks on Friday November 12, 2021 @02:34AM (#29197124)
It still feels like a prototype. There's still lack of integration with some major language features such as traits, and the standard library is missing all but the most rudimentary primitives; third party libraries help, but at the moment you are required to "takes sides" which async runtime library ecosystem you choose to use (for example, to spawn tasks), even though the thing you are doing doesn't require anything specific from that library. Finally, there are unsolved design problems about cancellation and destructors. And some murky behind-the-scenes stuff about the memory safety and soundness of self-referential types (which Futures often are).

I think that at least the trait integration stuff is taking some steps forward these days, and hopefully the cancellation stuff too, which this blog post is indicative of.

Re:Async Cancellation by GolDDranks on Friday November 12, 2021 @02:49AM (#29197178)
To be sure, Rust is trying to solve very hard problems here, given to requirements: the async system is supposed to work in very high-performance situations, without allocators on embedded etc., while trying to keep the individual features that support the system relatively straightforward and orthogonal. It feels like there has been not much progress since the initial release of async in 2018, but it's a good thing that the designs are not rushed.
Re:Async Cancellation by pas on Friday November 12, 2021 @11:26AM (#29201014)
Ergonomic async depends on a smarter type system (GAT), and a lot of progress has been made on that.
Re:Async Cancellation by bouke on Friday November 12, 2021 @02:01AM (#29196965)
Can you expand on the 5%?
Re:Async Cancellation by sershe on Friday November 12, 2021 @01:59PM (#29203199)
C# story is a classic example of well-implemented, but leaky abstraction. I would say 99% of the time it works fine and very intuitive. Then 1% of the time something utterly bizarre happens, I've definitely seen very un-intuitive examples when await is used with ContinueWith spawned in an unconventional manner, and the things get hopelessly muddled (you await task t in try-finally but finally only executes after some task that is not part of t completed is something I've seen iirc).

I've also seen un-intuitive perf issues with await where replacing it with manual continuations sped things up a lot; again, I think it's very rare, but when it happens it happens.

And yeah like the other comment mention, ConfigureAwait 0_o

Re:Async Cancellation by rawling on Friday November 12, 2021 @04:33AM (#29197634)
ConfigureAwait, probably