Skip to content

Latest commit

 

History

History

Completable

Completable & Completion

These "futures" or "yet another promises" are based on Task/TaskCompletionSource. They extend the capacities of the Tasks by bringing:

  • Covariance of the completion result.
  • Optional extension points to map errors (exceptions or cancellation) to regular results.

The read only and covariant model are the 2 interfaces ICompletion (no result) and ICompletion<out TResul> : ICompletion.

The real stuff are the sources of completion: CompletionSource and CompletionSource<TResult>.

A Completable is not, in itself, the important object here (note that ICompletable<TResult> is not covariant). A completable simply holds a completion and carries the OnError/OnCanceled/OnCompleted extension points, it is more to be used as an implementation detail than to expose it: the 3 extension points should typically be explicitly implemented.