NET Reactive Framework

From JVMLangSummit
Revision as of 15:17, 17 September 2009 by Jrose (talk | contribs)
Jump to navigationJump to search

.NET Reactive Framework

Erik Meijer, Microsoft



The .NET Reactive Framework — Erik Meijer

The .NET Reactive Framework (Rx) is an abstraction of the well-known Subject/Observer pattern derived as the mathematical dual of the iterator pattern.

We show how Rx can be used to program against event streams and asynchronous computations using LINQ syntax as well as using good old imperative code.


(roughly translated to roughly-Java syntax)


interface Enumerable<T> {
  Enumerator<T> getEnumerator();

interface Enumerator<T throws E> extends Disposable {
  bool moveNext();
  T current() throws E;


interface Observable<T> {
  // dual to getEnumerator:
  Disposable putObserver(Observer<? extends T> o);

// dual to Enumerator, except that Disposable is not dualized:
interface Observer<T throws E> extends Disposable {
  // dual to moveNext returning false:
  void onCompleted();
  // dual to current() returning x:
  void onNext(T x) ;
  // dual to current() throwing e:
  void onError(E e) ;


interface Subject<S,T> extends Observer<S>, Observable<T> {
  // observes values of type S, produces values of type T

Related Work

F# first-class events F# async workflows Thomas P. Reactive LINKQ (in F#) Esterelle, Lustre, ... Functional Reactive Programming (has continuous time) Unix pipes, PowerShell, SSIS, WWF (push-based data flow

Current Status


Key Issues for Discussion

(please expand cooperatively)