3 ms·
It is significantly better. The issue with futures is chaining them together and having to thread continuations by hand. Async/await is an improvement over that
by gpderetta 4y ago
It is significantly better. The issue with futures is chaining them together and having to thread continuations by hand. Async/await is an improvement over that, but when you can just block instead they become much nicer to use.
- kagakuninja 4y agoJava Futures are lobotomized. What is really nice is to treat Futures as monads (as in Scala, and FP languages like Haskell). Then you can chain them together using calls to flatMap aka bind. Then you can use for-comprehensions (or the equivalent): for { a <- taskA b <- taskB c <- taskC } yield a + b + c There are a ton of other fancy tricks found in Haskell or libraries such as Cats.