News for hackers. Stuff that matters.
Re:State of Loom by GolDDranks on Saturday May 16, 2020 @10:02AM (#23203438)
Async/await split up your functions at their "blocking points" to fragments that can be run fragment-by-fragment, in an interleaved way by an executor / event loop, thus enabling high level of concurrency within a single OS thread.

The problem is that your split-up async function ceases to be a normal function. It doesn't use the stack in a similar way than normal functions. Furthermore, the executor / event loop is required for running those async functions.

So you can't call async functions from normal functions, because they aren't. You need to create an event loop and then hand the task over for it to process it. Your world splits up into sync and async functions.

Go and Erlang are going with the similar "lightweight thread" approach as Java's project Loom. On the other hand, JS, Python and C# have gone with async. I'm not sure if these languages actually need async, going with something similar as project Loom would have also fit, and would have been simpler from the user perspective, perhaps? But hindsight is 20/20.

Rust has also gone async, and I'd argue it's the only one of the pack who really have async/await as a necessity - this is because of two design requirements that differ from Java, C#, Python and JS: 1) must have native-level performance when calling foreign code that expects a C-like stack. Something like Loom doesn't provide that. 2) must not have an implicit default runtime.

Re:State of Loom by yrio on Saturday May 16, 2020 @08:03PM (#23208242)
Python is popular in data science, AI & those field depends on a lot of native libraries: NumPy, SciPy, etc. Maybe that's why they chose the async await model
Re:State of Loom by GolDDranks on Sunday May 17, 2020 @06:14AM (#23210972)
Yeah, sounds plausible. A lot of Python stuff is actually wrapped C / C++ / Fortran code, so it makes sense to optimize for FFI.
Re:State of Loom by int_19h on Saturday May 16, 2020 @10:05PM (#23208852)
Those other languages do async because they're less insular, and want to interoperate with the world outside of their own runtime.
Re:State of Loom by sk5t on Saturday May 16, 2020 @09:32PM (#23208692)
> The problem is that your split-up async function ceases to be a normal function. It doesn't use the stack in a similar way

Have you taken the CLR (a.k.a. .NET / C#) async await for a spin? Microsoft's done a great job of squaring away those details so the stack/thread discontinuity doesn't much matter.

Re:State of Loom by pjmlp on Sunday May 17, 2020 @02:37AM (#23210063)
It kind of does, specially if you don't take care with ConfigureAwait().