Swift is getting async, structured concurrency and actors

Sebastiaan Koppe mail at skoppe.eu
Sat Dec 12 10:12:40 UTC 2020


On Friday, 11 December 2020 at 20:08:30 UTC, Jacob Carlborg wrote:
> As the title says, Swift is getting language support for: 
> async/await [1], structured concurrency [2] and actors [3]. The 
> implementation has already started, available in master.

I personally think async/await isn't that pretty. I find it very 
infectious. Before long your whole program has async/await 
everywhere.

If you think about it, async/await, concurrency and coroutines 
wouldn't exist if it wasn't for IO and our desire to do useful 
work when a piece of code is waiting on it.

Async IO is one way to fix it, but that generally leads to 
callback hell, and hence to async/await.

Vibe.d and photon are two approaches that fix it without callback 
hell, and thus without async/await.

Vibe.d has its warts and photon is mostly DOA, but they do show a 
promising alternative.

> Seems like D is more or less the only language without language 
> support for async/await now. But perhaps it's possible to 
> implement only in library code. Kotlin has language support for 
> coroutines, but async/await is implemented in library code. D 
> already has fibers (kind of like coroutines) implemented in 
> library code.

It mostly is, but it needs to integrate with the GC as well.


More information about the Digitalmars-d mailing list