Why not including async/await ?

jfondren julian.fondren at gmail.com
Fri Sep 24 06:00:30 UTC 2021


On Friday, 24 September 2021 at 03:16:36 UTC, zoujiaqing wrote:
> Swift 5.5 including async/await.
> C# Support it.
> TypeScript support it.
> Kotlin support it.

And Nim, and Rust, and Zig. I think of it as a lot like garbage 
collection:

1. deadlocks (memory errors) are too hard to deal with! Why can't 
software handle this instead of us poor programmers?

2. async funcs (GC-using functions) are cleaner and easier to 
write. Don't mind the invisible extra work.

3. huh, this new cure-all comes with surprising downsides like 
'colored functions' (GC-assuming APIs) that are annoying to 
expose to the C ABI, and that want other functions to share their 
'color' (also use/avoid GC), and extra overhead, and--

Past the trivial client-side examples and synchronous callback 
hell, you start caring about the actual concurrent architecture 
of your program, but you no longer have any control to architect 
anything with. That's my limited experience, anyway. If you know 
of a good salespitch, "Erlang devs! Stop letting mailboxes hold 
you back! Join the new order!", I'll watch it.

Meanwhile:

https://code.dlang.org/packages/dawait

That's using core.thread.fiber directly, but by removing that you 
could make it compatible with a simple `import 
vibe.core.concurrency;` and then 
`setConcurrencyPrimitive(ConcurrencyPrimitive.workerTask);` to 
use vibe-core's fiber scheduler.


More information about the Digitalmars-d mailing list