News for hackers. Stuff that matters.
Re:Why choose async/await over threads? by miohtama on Monday March 25, 2024 @11:20AM (#39817426)
Also there is the extra software development and maintenance cost due to coloured functions that async/await causes

https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...

Unless you are doing high scalability software, async might not be worth of the trade offs.

Re:Why choose async/await over threads? by nine_k on Monday March 25, 2024 @02:55PM (#39820003)
If you expect to color your functions async by default, it's really easy to turn a sync functuion into a near-zero-cost async, a Future that has already been resolved at construction time by calling the sync function.

This way, JS / TS becomes pretty comfortable. Except for stacktraces, of course.

Re:Why choose async/await over threads? by yencabulator on Monday March 25, 2024 @03:36PM (#39820447)
Except when your sync function calls a function that makes the async runtime deadlock. No, there's no compiler error or lint for that. Good luck!
Re:Why choose async/await over threads? by ngrilly on Tuesday March 26, 2024 @07:34AM (#39826576)
Useful stacktraces is one of the reasons why I use Go instead of JS/TS on the server-side.
Re:Why choose async/await over threads? by RReverser on Tuesday March 26, 2024 @08:07AM (#39826826)
JS has proper async stacktraces as well, or do you mean something else?
Re:Why choose async/await over threads? by ngrilly on Tuesday March 26, 2024 @08:25AM (#39826981)
You're right. But it was not the case years ago when my team evaluated Go and Node.js. I should have clarified.
Re:Why choose async/await over threads? by laggyluke on Tuesday March 26, 2024 @08:52AM (#39827222)
> Useful stacktraces is one of the reasons why I use Go

I'm not sure if this is sarcasm or not.

Re:Why choose async/await over threads? by ngrilly on Tuesday March 26, 2024 @10:45AM (#39828575)
Fair enough. The context is that years ago, my team was evaluating Go and Node.js as options for a server requiring concurrency, and back then Node.js didn't provide any stacktrace for async callbacks. I know it has been improved since then, but I don't use Node.js.

What do you miss in Go's stack traces?