joboccara/pipes

Clarify the difference between Ranges and Pipes

Closed this issue · 2 comments

In .Net (c#) the difference is clear. They have IEnumerable and IObservable. Roughly speaking

Ranges are IEnumerable ( interactive )

and

Pipes are IObservable ( reactive )

The basic interfaces of each type have the same shape with the difference described succinctly.

IEnumerable allows you to write queries over space
IObservable allows you to write queries over time

or another way to see it is that

IEnumerable is pull based. The consumer asks for the next value
IObservable is push based. The consumer waits for the next value

That being said there exists a library call ReactiveExtensions that has a C++ port that follows the same reactive model that Pipes uses. https://github.com/ReactiveX/RxCpp Maybe you can get some inspiration from that code. There are loads of operators for dealing with time that space based query engines such as rangev3 don't need to worry about. async and threads and scheduling etc.

Regards

Brad

Thanks Brad for presenting the design differences this way, and for the references. I've updated the documentation to include this insight about the design.

MSK61 commented

Can someone explain the difference between RxCpp and Pipes, or what factors may affect the decision to use one instead of the other? For me it looks like both Pipes and RxCpp cover the same front.