3 ms·
The original "colors" article talked about two things: 1. Inability for sync functions to use async functions, which can have big consequences for API design a
by pornel 4y ago
The original "colors" article talked about two things:
1. Inability for sync functions to use async functions, which can have big consequences for API design and ability to refactor applications.
2. Author's opinion on how async syntax should (not) look like.
Rust can mitigate the first problem. It can have `block_on(async)` and `spawn_sync(fn)` which allows bridging between "colors" of functions, so functions aren't forever stuck with their "color". This is something that JS can't do without massive hacks, and is the objectively important aspect of "colors".
The other thing was about difference in calling syntax. That is just a design choice and a subjective preference. Rust prefers locally explicit syntax. It cares about low-level details and intentionally avoids having implicit magic, especially for major behaviors affecting control flow, safety of stack pointers, and risk of deadlocks.
Regarding runtimes: in practice it's easy to just stick to tokio. It's 8x more popular than the second contender, and there aren't any important libraries that don't work with tokio. Rust can have multiple runtimes in the same program. You can have futures running on different runtimes await each other, it's just wasteful (you get multiple event loops, thread pools, etc.), which means it's best to pick one and stick with it.
- aaaaaaaaaaab 4y ago>in practice it's easy to just stick to tokio. It's 8x more popular than the second contender, and there aren't any important libraries that don't work with tokio. For now. Python2.7 used to be 8x more popular than python3.
- pornel 4y agoThat’s an empty speculation, and the analogy is flawed. Other runtimes aren’t tokio’s imposed replacement. Runtimes create self reinforcing network effect, so it’s more likely that all other contenders will die out completely.