Remix.run Logo
pkolaczk 5 hours ago

Threads are neither better or worse than async+callbacks. They are different. There are problems which map nicely to threads and there are problems which are much nicer to express with async.

groundzeros2015 5 hours ago | parent [-]

Such as? The entire premise of async is that callbacks were a mistake because they broke sequential reasoning and control.

Every explanation of the feature starts with managing callback hell.

repelsteeltje 4 hours ago | parent | next [-]

Beware, they are different concepts.

Threads offer concurrent execution, async (futures) offer concurrent waiting. Loosely speaking, threads make sense for CPU bound problems, while async makes sense for IO bound problems.

groundzeros2015 8 minutes ago | parent [-]

Why? You write the same code with async await but with a keyword at the beginning of every function.

codedokode 4 hours ago | parent | prev [-]

The callbacks should be just hidden from programmer, that's what async/await are for.