Add missing include for flock()
[folly.git] / folly / wangle / rx / README.md
1 Rx is a pattern for "functional reactive programming" that started at
2 Microsoft in C#, and has been reimplemented in various languages, notably
3 RxJava for JVM languages.
4
5 It is basically the plural of Futures (a la Wangle).
6
7 ```
8                     singular              |            plural
9         +---------------------------------+-----------------------------------
10   sync  |  Foo getData()                  |  std::vector<Foo> getData()
11   async |  wangle::Future<Foo> getData()  |  wangle::Observable<Foo> getData()
12 ```
13
14 For more on Rx, I recommend these resources:
15
16 - Netflix blog post (RxJava): http://techblog.netflix.com/2013/02/rxjava-netflix-api.html
17 - Introduction to Rx eBook (C#): http://www.introtorx.com/content/v1.0.10621.0/01_WhyRx.html
18 - The RxJava wiki: https://github.com/Netflix/RxJava/wiki
19 - Netflix QCon presentation: http://www.infoq.com/presentations/netflix-functional-rx
20 - https://rx.codeplex.com/
21
22 There are open source C++ implementations, I haven't looked at them. They
23 might be the best way to go rather than writing it NIH-style. I mostly did it
24 as an exercise, to think through how closely we might want to integrate
25 something like this with Wangle, and to get a feel for how it works in C++.
26
27 I haven't even tried to support move-only data in this version. I'm on the
28 fence about the usage of shared_ptr. Subject is underdeveloped. A whole rich
29 set of operations is obviously missing. I haven't decided how to handle
30 subscriptions (and therefore cancellation), but I'm pretty sure C#'s
31 "Disposable" is thoroughly un-C++ (opposite of RAII). So for now subscribe
32 returns nothing at all and you can't cancel anything ever. The whole thing is
33 probably riddled with lifetime corner case bugs that will come out like a
34 swarm of angry bees as soon as someone tries an infinite sequence, or tries to
35 partially observe a long sequence. I'm pretty sure subscribeOn has a bug that
36 I haven't tracked down yet.