A Future represents a computation that can be executed asynchronously. Any object that implements TAsyncFuture Trait named: #TAsyncFuture instanceVariableNames: '' package: 'Futures-Base - Futures' trait can be used as a future. It is important to mention that futures are not executed at the moment of their creation, instead they should be explicitly run by the future executor.

Future combinators

The beauty of futures is that they can be combined to create complex futures. Here is a list of all available future types that can be combined in many ways:

Simple future

A BlockClosure Object variableSubclass: #BlockClosure instanceVariableNames: 'outerContext compiledBlock numArgs' classVariableNames: '' package: 'Kernel-Methods' can be made into a Future by sending BlockClosure>>#asAsyncFuture asAsyncFuture ^ AsyncPollFuture pollBlock: self :


	^ [ 21 * 2 ] asAsyncFuture

The return value can be then transformed or mapped as follows:

	| future |
	future := self simpleFuture asAsyncFuture.
	future := future map: [ :x | x * 2 ].

	^ future