Futures [9] are place-holders or 'IOUs' for values or
computations. Future abstractions are
useful in parallel programming because they allow asynchronous
computation by enabling delaying the
computation of the value of an object until the value is
required. Good abstractions for futures are useful in writing parallel
programs that look similar to their sequential counterparts. Coir<Futures>
supports two kinds of futures - data futures and computation
futures. Data futures are simple place-holders for values. The futures
are resolved by some arbitrary computation entering a value into the
future. Computation futures are those that represent a delayed
computation (execution of a function). The value of a computation
future is the value returned by the function that represents the computation.
Data futures are templatized on the base types of the values they
represent. Computation futures are templatized on the signature of the
computations (functors) they represent. Since the return type of a function is a
part of its signature, the base type of the value that the future
represents is hidden in the template parameter. Future classes also support
a cast operator to their base types. The cast operator is a blocking
operator and waits for the future resolution i.e., for the future to have
a valid value.