4 ms·
Is there any plans to include async/await on the language level?
by rilut 8y ago
Is there any plans to include async/await on the language level?
- azernik 8y agoasync/await is a special case of monads (expressible with a for-comprehension); it comes out to: def asyncFunction(): Future[Blah] = for { foo <- someAsynchronousOperation bar <- anotherAsynchronousOperation } yield bar.baz
- saosebastiao 8y agoI find async/await to be much better for conditional execution, especially with lots of branches. For example, I had a scenario where I tried one async call and if it didn't have the information I needed, I had to make two subsequent async calls to get the information I needed before proceeding with the final call. Monadic composition was a nightmare where async/await was perfectly suited to the task.
- clhodapp 8y agoFor comprehensions are currently tremendously limited vs async/await. They constrain the top-level of your code structure to a tiny subset of the language.
- modersky 8y agoWe will check first whether they can be expressed as a macro (the macro roadmap for Scala 3 is still evolving).
- 62747478182 8y agoThere is https://github.com/scala/scala-async https://github.com/scala/scala-async, which is already implemented as a macro, though it is a bit limited