3 ms·
We used to have M:N threading in Rust's runtime -- this is one other way to achieve what we wanted. It imposed a cost on all programs, including those which wer
by Manishearth 7y ago
We used to have M:N threading in Rust's runtime -- this is one other way to achieve what we wanted. It imposed a cost on all programs, including those which weren't using it, and iirc it didn't fit well and wasn't flexible enough (I'm not sure of this) and it got removed.
Async/await/futures with library level scheduling is basically the only way to get the benefits of application threads in rust without such downsides.
- dboreham 7y agoBut with other downsides such as making application code less easy to debug and maintain.
- skybrian 7y agoCertainly, but if you're willing to commit to one runtime for your app, there are plenty of other choices: Go, Erlang, Kotlin, Swift, Typescript or Dart might be better bets. Web browsers and mobile phone apps do well with this approach. Rust (along with C or Zig) has an interesting use case for building large libraries that can be reused across different runtimes via foreign function calls. It's paying some usability for the library maintainer for being able to work in more environments. To speculate a bit, I expect we will eventually see some interesting new runtime environments built out of the various libraries in the Rust ecosystem. (Along with C of course, which is how runtimes are built now.) Maybe we will see a trend away from reimplementing all the libraries in whatever the hot new language is, in favor of building on a more persistent set of stable libraries? (Already true today with C, but the Rust ecosystem could evolve into something more cohesive.)