Re:Tokio 1.0 – async runtime for Rust
by sanxiyn on Wednesday December 23, 2020 @06:26PM
(#25523478)
We are talking about Rust. There is no consensus in Rust.
Re:Tokio 1.0 – async runtime for Rust
by afavour on Wednesday December 23, 2020 @07:13PM
(#25523822)
I think the OP was using examples from a different ecosystems to demonstrate how such a consensus could be reached, if people wished for it.
Re:Tokio 1.0 – async runtime for Rust
by sanxiyn on Wednesday December 23, 2020 @07:17PM
(#25523852)
I don't wish it. That sounds terrible to me.
Re:Tokio 1.0 – async runtime for Rust
by afavour on Wednesday December 23, 2020 @09:03PM
(#25524426)
I think your comments have made that clear. Which is fair enough. But I imagine others feel differently.
Re:Tokio 1.0 – async runtime for Rust
by chrismorgan on Thursday December 24, 2020 @01:16AM
(#25525432)
I have seen fs.*Sync functions being called deep in async-land more than once or twice in Node.
Those methods were added super early (node 0.2 or something) and can’t be removed because of backwards compatibility. Many of the core node team think they should never have been added - for that exact reason.
I feel like the "what color is your function" thing is incomplete. There are arguably 3 types of functions:
- Functions which do all their work synchronously and return without blocking
- Async functions which contain an internal state machine
- Functions which block on expensive IO or long computations
Mixing blocking functions and async functions in the same kernel thread leads to various performance disasters. Javascript is so meticulous about not having blocking IO in part because its basically impossible to tell from a function's signature whether it will block the thread. Lua has this problem - callback oriented lua feels like a natural fit for the language, but lots of 3rd party libraries are packed with blocking calls. Writing asyncronous lua feels like fighting a river. You have to constantly guard against calling blocking code, and most API docs won't tell you where they block.