3 ms·
> [async] “colorless” I’m super interested that you think that’s something that can exist, how would it work, what would it look like in your mind ?
by navaati 6y ago
> [async] “colorless”
I’m super interested that you think that’s something that can exist, how would it work, what would it look like in your mind ?
- robinei 6y agoZig does it (https://kristoff.it/blog/zig-colorblind-async-await/ https://kristoff.it/blog/zig-colorblind-async-await/). Basically using "await" just means you are declaring opportunity for concurrency at the call site, but it is still valid to await a synchronous function. And it is valid to call a function synchronously, even if it internally supports concurrency via await.
- kristoff_it 6y agoYes, that's a very clear and concise way of putting it, thanks.
- littlestymaar 6y agoI think the GP refers to Zig's approach[1], which is just “do mark functions as sync or async in there signature, just switch between two modes at compile-time using a global flag”, which I don't think fits well into Rust's values of being explicit about what is happening. [1]: https://kristoff.it/blog/zig-colorblind-async-await/ https://kristoff.it/blog/zig-colorblind-async-await/