3 ms·
> Would be great if functions could be written in a general way for both IO models and users could select the implementation at their convenience. We tried thi
by pcwalton 10y ago
> Would be great if functions could be written in a general way for both IO models and users could select the implementation at their convenience.
We tried this with a compile-time switch between 1:1 and M:N threading in earlier versions of Rust and the results pleased nobody. It was slow, complex, and unwieldy.
- saynsedit 10y agoIt's my understanding that the alternative green thread runtime used stack swapping. What I'm referring to here is the same futures method under the hood but transparent to the user. It's also my understanding that there were unrelated engineering constraints that caused it to be unwieldy, such as binary size. I believe it's possible to provide an alternative runtime without it necessarily affecting the main configuration or limited environments like embedded devices.
- pcwalton 10y ago> What I'm referring to here is the same futures method under the hood but transparent to the user. CPS transforming the entire program is possible in theory, but if you want the same zero-cost behavior you will run into the same issues I outlined elsewhere: higher order control flow analysis will be necessary, and it will fall down a lot.