Summary
This chapter presented some powerful abstractions for asynchronous programming. We have seen how to encode latency with the Future type, how to avoid blocking with callbacks on futures, and how to compose values from multiple futures. We have learned that futures and promises are closely tied together and that promises allow interfacing with legacy callback-based systems. In cases where blocking was unavoidable, we learned how to use the Await object and the blocking statement. Finally, we learned that the Scala Async library is a powerful alternative for expressing future computations more concisely.
Futures and promises only allow dealing with a single value at a time. What if an asynchronous computation produces more than a single value ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access