43 ms·
> By contrast, calling async code from sync code requires a special blocking wrapper (Python) ... That's exaclty my point. If you don't have async by default i
by scotty79 2y ago
> By contrast, calling async code from sync code requires a special blocking wrapper (Python) ...
That's exaclty my point. If you don't have async by default in your platform you need to do stupid things to fake it. If function calls and main in Python were innately async you could be calling async code just as easily as sync code.
> [...] or unavoidably breaks control flow (JavaScript).
async/await syntax avoids it completely.
Tbh await should be default function call semantics and there should be special keyword for calling without awaiting. But since we come from sync primitives that would require small revolution that might happen at some point.
> Async is syntactic sugar
You could make sync code be syntactic sugar for await.
- gpderetta 2y ago> would require small revolution that might happen at some point. or python could have blessed gevent and done away with all the nonsense.
- btown 2y agoI hope that someone does an oral history of why gevent wasn't seen as the solution here. The existence of models like Twisted, and a general idea that yields to an event thread should be explicit in some way, I think caused the exact kind of fracturing of the ecosystem that everyone was trying to avoid. "Everyone will write async code" simply didn't happen in practice.
- v3ss0n 2y agoSo many production problems that we never seen in development comes in and no way to debug
- v3ss0n 2y agoYou had never tried gevent in production then. As soon as workload and concurrency increases python programs with gevent or gevent based drivers, especially monkey patches causes unexpected crashes out of the blue, no way to debug, no error message,Memory leaks and whole slew of nightmares
- crubier 2y ago> Tbh await should be default function call semantics and there should be special keyword for calling without awaiting. Your comment made me realize this is exactly what golang "go" keyword does. This is actually great.
- gpderetta 2y agoalso Cilk spawn.