3 ms·
Rust's green threading was... unusual. It attempted to abstract green and native threads into a single API, which lead to a lot of unnecessary overhead: https:
by acconsta 11y ago
Rust's green threading was... unusual. It attempted to abstract green and native threads into a single API, which lead to a lot of unnecessary overhead:
https://github.com/rust-lang/rfcs/blob/0806be4f282144cfcd55b1d20284b43f87cbe1c6/text/0230-remove-runtime.md https://github.com/rust-lang/rfcs/blob/0806be4f282144cfcd55b...
Sadly, that proposal also removed concurrent IO from the standard library, and it hasn't been replaced.
- steveklabnik 11y agoIt may not be replaced in the standard library, but mio exists and is what most people use for non-blocking stuff.
- acconsta 11y ago1. Stackless coroutines will probably require help from the compiler team (hint hint). It'll be worth it! Think web frameworks with Nginx performance and Rust memory safety. 2. Documentation, stability, portability, quality. I'll keep banging that drum until there's a standard. :) 3. The Mio API is subjectively weird, but I might be missing something.
- dbaupp 11y agoThe first point has been on the radar for quite a while (i.e. years), but it's really non-trivial, and not at all necessary for the core language (hence not a priority for stability) since it's basically just some syntactic niceties over existing functionality.
- acconsta 11y ago> it's basically just some syntactic niceties over existing functionality. OK, cool! Can you point us to the existing functionality, or any example of it being used for stackless coroutines?
- dbaupp 11y agoEnums. This HN submission is an example.
- acconsta 11y agoState machines aren't a general solution — you have to write a state machine by hand for every application. Stackless coroutines are — the compiler (or a clever library) transforms your ordinary function into a state machine.
- dbaupp 11y agoYes, I know. That's exactly what I mean by syntactic sugar: it is an automated way to write something that could already be written, but is annoying to do by hand.
- acconsta 11y agoOh, OK. When I hear syntactic sugar, I think of like a macro. Thanks though, I'm glad this is on the core team's radar.