Copyright 2013, 2014 Wuala / andee@wuala.com
"Reactive systems have been defined by Harel and Pnueli [On the development of reactive systems, 1985] as systems that are supposed to maintain an ongoing relationship with their environment. Such systems do not lend themselves naturally to description in terms of functions and transformations: they cannot be described adequately as computing a function from an initial state to a terminal state. On the contrary, behaviours of reactive systems are better seen as reactions to external stimuli. The role of reactive systems is to react continuously to external inputs by producing outputs. For example, man–machine interface handlers or computer games fall into the category of reactive systems."
Reactive C: An Extension of C to Program Reactive Systems (F. Boussinot, 1991)
int a = 15;
int b = 16;
int c = a + b;
a = 42;
// What is the value of c ?
public interface Iterable<T> { Iterator<T> iterator(); }
public interface Iterator<E> { boolean hasNext(); E next(); void remove(); }
public interface Iterable<T> { Iterator<T> iterator(); }
public interface Iterator<E> { boolean hasNext(); E next();
void remove();}
public interface Iterable<T> { Iterator<T> iterator(); }
public interface Iterator<E> { boolean hasNext();
E next() throws Exception; }
public interface Iterable<T> { Iterator<T> getIterator(void); }
public interface Iterator<E> { boolean hasNext(void);
E getNext(void) throws Exception; }
public interface Iterable<T> { Iterator<T> getIterator(void); }
public interface Iterator<E> { (true | false) hasNext(void);
(E | Exception) getNext(void); }
public interface Iterable<T> { Iterator<T> getIterator(void); }
public interface Iterator<E> { (true | false) hasNext(void);
(E | Exception) getNext(void); }
public interface Iterable<T> { Iterator<T> getIterator(void); }
public interface Iterator<E> {
(true | false) hasNext(void);(E | void | Exception) getNext(void); }
public interface IterableDual<T> { void someMethod(IteratorDual<T> it); }
public interface IteratorDual<E> {
void firstMethod(E elem);
void secondMethod(void);
void thirdMethod(Exception ex);
}
public interface IterableDual<T> { void setIteratorDual(IteratorDual<T> it); }
public interface IteratorDual<E> {
void gotNext(E elem);
void gotNothing(void);
void gotException(Exception ex);
}
public interface Observable<T> { Closable subscribe(Observer<T> observer); }
public interface Observer<E> {
void onNext(E value);
void onCompleted();
void onException(Exception ex);
}
Observable.just(42) ------O-----|---->
Observable.empty() ------------|---->
Observable.error() ------------x---->
Observable.never() ----------------->