Re:Java Is in Decline, and There's Data to Prove It
by tluyben2 on Sunday January 01, 2023 @09:43AM
(#34206599)
Can you provide a good cheap thread example for Java vs async/await. What I find online is horrible compared to async/await but people keep talking about function colouring etc. I just cannot see what is the issue. Nor do people give better examples; I was watching some guy on YouTube who said async/await sucks and my idea is better, then spent 30 minutes explaining his idea vaguely. No implementation, no examples.
[ Parent
| on HN ]
Re:Java Is in Decline, and There's Data to Prove It
by nlitened on Sunday January 01, 2023 @12:50PM
(#34208692)
In the simplest case, you take an async function, remove `async` and `await` keywords, and as a result you get a normal function which you can call and get a result without awaiting, which has better and more predictable performance, and a straightforward stack trace (and a simpler language syntax and semantics). All upsides, no downsides.
Probably you can think of a more complex example where itβs not that straightforward, please link code that you have in mind, we can see how with cheap threads it could be made better.