August 2018
Intermediate to advanced
380 pages
10h 2m
English
Let's look at a functional way of writing this example. In the functional world, one abstraction to deal with asynchronous computations is Future. Future has the following signature—Future[A]. This type represents a computation that runs in a separate thread and computes some result, which in our case is A.
A common technique when dealing with Futures is to use callbacks to specify continuations of the computations. A continuation of a computation is an instruction on what to do after the computation has completed. A continuation has access to the result of the computation it continues. This is possible since it runs after the computation terminates.
In most implications of the Future data type, the ...