The Scala Async library
In the final section of this chapter, we turn to the Scala Async library. You should understand that the Scala Async library does not add anything conceptually new to futures and promises. If you got this far in this chapter, you already know everything that you need to know about asynchronous programming, callbacks, future composition, promises, and blocking. You can start building asynchronous applications right away.
Having said that, the Scala Async library is a convenient library for futures and promises that allow expressing chains of asynchronous computations more conveniently. Every program that you express using the Scala Async library can also be expressed using futures and promises. Often, the Scala Async library allows writing shorter, more concise, and understandable programs.
The Scala Async library introduces two new method calls--the async
and await
methods. The async
method is conceptually equivalent to the Future.apply
method; it starts an asynchronous...