Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> [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 ?



I 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/


Zig does it (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.


Yes, that's a very clear and concise way of putting it, thanks.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: