3 ms·
I'm not sure whether I follow. Are you saying that basically everything should be async, but the compiler should just optimize that away when it's not "actually
by GolDDranks 4y ago
I'm not sure whether I follow. Are you saying that basically everything should be async, but the compiler should just optimize that away when it's not "actually" async? Or did I misunderstand you.
- jupp0r 4y agoExactly. This is also necessary for the example code in the keyword generics proposal. You still need to write a .await and treat everything as being potentially async. Compare this to C++20s coroutine design where you practically have a zero overhead abstraction that might or might not be async without the author of the function having to necessarily know. They just yield control flow back to the caller who might suspend execution or not. I’m not saying that one design is better than the other, just that this seems to be a bandaid on top of existing tradeoffs made in Rust’s async design that is only 2 years old.