Why doesn't Task<T> implement IObservable<T>
c#, system.reactive, task-parallel-library
Solution
I hope it would be pertinent to quote Stephen Toub, MSFT (*) from his:
ParallelExtensionsExtras Tour - #2 - Task.ToObservable MSDN blog article:
As it turns out, while `Task<TResult>` does not currently implement `IObservable<T>`, it’s actually quite a good fit to do so. An observable represents any number of values terminated by either an end of the stream or by an exception. A `Task<TResult>` fits this description: it completes with either a single value or with an exception. While it’s possible that a future version of the .NET Framework will see `Task<TResult>` implement `IObservable<T>`, we can get the relevant behavior now by implementing it as an extension method for `Task<TResult>`; in fact, Rx includes just such an extension method, as does `ParallelExtensionsExtras`
(*) not sure what "FT" means, except that MSFT is NASDAQ stock symbol meaning MS, but "MS" in "MSFT" certainly means Microsoft
Problem
`Task<T>.ContinueWith` has the same basic underlying concept as `IObservable<T>.Subscribe`. They are similar enough for Reactive Extension to provide a conversion extension method. Since `IObservable<T>` is part of the BCL, there is no reason not to implement `IObservable<T>`. So, what is the reasoning behind `Task<T>` not implementing `IObservable<T>`?