Live data from Hacker News

Why asynchronous Rust doesn't work

theta.eu.org

491–499 of 499 posts

Re: Why asynchronous Rust doesn't work

#491

Earlier quoted context omitted.

No doubt. In any case, the author notes his main influences in footnote 3, and those are not part of that. It seems he has a more practical than academic background in this.

The author of the talk, Vivek Sarkar, is co-author in both the X10 paper from 2004 and the Habanero paper of 2011. That's why those are not part of his influences, he co-wrote those papers.

I was referring to the author of vorpus post I posted.

Re: Why asynchronous Rust doesn't work

#492

Earlier quoted context omitted.

I'm a giant Rust fanboy and have been since about 2016. So, for context, this was literally before Futures existed in Rust. But, I only work on Rust code sporadically, so I definitely feel the pros and cons of it when I switch back and forth to/from Rust and other languages. The problem, IMO, isn't about allocations or ownership. In fact, I think that a lot of the complaints about async Rust aren't even about async R…

also a long-time rust user, and I buy this. one of the things it took me longest to realize when writing rust is to reach for traits carefully/reluctantly. they can be amazing (e.g. serde), but I've wasted tons of time trying to make some elegant trait system work when I could have solved the problem much more quickly otherwise.

Exactly. Which is unfortunate, because the fact that Rust has true type classes is absolutely awesome.

But when dealing with traits, you have to remember the orphan rules, and the implicit object-safety rules- which sucks, because you might not have planned on using trait objects when you first defined the trait, but only tried to do so later.

Async definitely makes it even more painful.

Re: Why asynchronous Rust doesn't work

#493
post #481

Earlier quoted context omitted.

Definitely dynamic dispatch + async brings out a lot of pain points. But I only agree that the async part of that is unfortunate. Making dynamic dispatch have a little extra friction is a feature, not a bug, so to speak. Rust's raison d'être is "zero cost abstraction" and to be a systems language that should be viable in the same spaces as C++. Heap allocating needs to be explicit, just like in C and C++. But, I agre…

Is there any chance of fixing Pin/Unpin via a later Rust edition?

I don't know. But the Rust team is VERY against introducing any breaking changes. So we're stuck with the semantics we have today.

Re: Why asynchronous Rust doesn't work

#494

Earlier quoted context omitted.

The author of the talk, Vivek Sarkar, is co-author in both the X10 paper from 2004 and the Habanero paper of 2011. That's why those are not part of his influences, he co-wrote those papers.

I was referring to the author of vorpus post I posted.

Ah I see.

Re: Why asynchronous Rust doesn't work

#495
post #189

Earlier quoted context omitted.

I agree that Rust async is currently in a somewhat awkward state. Don't get me wrong, it's usable and many projects use it to great effect. But there are a few important features like async trait methods (blocked by HKT), async closures, async drop, and (potentially) existential types, that seem to linger. The unresolved problems around Pin are the most worrying aspect. The ecosystem is somewhat fractured, partially…

Is there a good explanation on the difference between polling model and completion model? (not Rust-specific)

I go into a lot of detail in this deck, here's a good starting slide: https://speakerdeck.com/trent/pyparallel-how-we-removed-the-...

Re: Why asynchronous Rust doesn't work

#496

Earlier quoted context omitted.

>In an completion based design the future itself tells the runtime that the value is ready I think there is a misunderstanding. In a completion-based model (read io-uring, but I think IOCP behaves similarly, though I am less familiar with it) it's a runtime who "notifies" tasks about completed IO requests. In io-uring you have two queues represented by ring buffers shared with OS. You add submission queue entries (SQ…

Doesn't work because it relies on caller-managed buffers. See withoutboats' post: https://without.boats/blog/io-uring/

It does not work in the current version of Rust, but it's not given that a backwards-compatible solution for it could not have been designed, e.g. by using a deeper integration of async tasks with the language or by adding proper linear types, thus all the discussions around reliable async Drop. The linked blog post takes for given that we should be able to drop futures at any point in time, which while being convenient has a lot of implications.

Re: Why asynchronous Rust doesn't work

#497

A bigger problem in my opinion is that Rust has chosen to follow the poll-based model (you can say that it was effectively designed around epoll), while the completion-based one (e.g. io-uring and IOCP) with high probability will be the way of doing async in future (especially in the light of Spectre and Meltdown). Instead of carefully weighing advantages and disadvantages of both models, the decision was effectively…

This post is completely and totally wrong. At least you got to ruin my day, I hope that's a consolation prize for you. There is NO meaningful connection between the completion vs polling futures model and the epoll vs io-uring IO models. comex's comments regarding this fact are mostly accurate. The polling model that Rust chose is the only approach that has been able to achieve single allocation state machines in Rus…

Please keep going, Rust is awesome and one of the few language projects trying to push the efficient frontier and not just rolling a new permutation of the trade-off dice.

Re: Why asynchronous Rust doesn't work

#498
post #490

Earlier quoted context omitted.

impl Trait is an existential type, not a subtype relationship. And it doesn't really mean "Liskov substitutable" either. After all, it names a single type, just un-named. > would making an working implementation (that makes a lot of arbitrary choices about syntax, efficiency etc.) advance the conversation? I don't know. It might, but it's also possible that the team has other objections I'm not aware of.

> impl Trait is an existential type, not a subtype relationship. And it doesn't really mean "Liskov substitutable" either. After all, it names a single type, just un-named. Well, "impl Iterator " is clearly not the same thing as "Vec ", but "Vec " is Liskov-substitutable for it. AFAICS it meets every definition of a subtype unless you take the position that "impl Iterator " isn't a type at all, which begs the questio…

`Vec` or `vec::IntoIter` being a subtype of `impl Iterator` would imply that you could take have a vec of type `Vec>` and have many structs of different types stuffed in, that all implement `Iterator`. You can't do that, ergo, it's not a subtype.

Re: Why asynchronous Rust doesn't work

#499
post #162

What’s wrong with async_std? The author calls it spicy. I’ve been using Surf and Tide which are built atop it and things have been a breeze. It is essentially a standard lib where all functions are red (a solution as I’d interpret things based on the linked rant). In my experience rust async’s only wart is the incredibly confusing function signatures you get with Box<Pin<... which I would think can be cleaned up.

> What’s wrong with async_std? The problem is that it exists. Or rather, that multiple async libraries exist and every attempt to employ asynchronous programming in Rust inevitably leaves you with the problem of aligning these different, redundant, incompatible, incomplete, evolving async libraries, which is an unmitigated disaster. Rust, all by itself, is a non-trivial hill climb for developers. They're willing to b…

This is why I like async_std. It’s literally the same types as the normal standard lib but it returns futures for anything that could block. If you know the normal standard lib then you know async_std. I’ve stayed the hell away from Tokio for the reasons you’re expressing, but async_std seems like a solution to the problem, not a cause.
Post reply on HN