265818 (11) [Avatar] Offline
#1
I just started to understand C++ Actor Framework (http://actor-framework.org/) .
Do you know any projects, better oper-source, which actually use this C++ Actor Framework in conjunction with functional approach, thus implementing "Functional Reactive Programming"? I do not really grasp how to use this framework with the functional approach and "tools" you explained in your good book.
Looking for Functional Reactive examples in C++ I found this two libraries: https://github.com/grantila/q (http://libq.io/) and https://github.com/SodiumFRP/sodium-cxx a porting to C++ of a sodium library , both of which seem interesting but not enough mature to be deployed
Looking forward to your kind hints.
Marco
265818 (11) [Avatar] Offline
#2
.
Ivan Cukic (75) [Avatar] Offline
#3
Hi,


The problem is that FRP means a dozen different things to different people.

The C++ Actor Framework implements (CAF) the so-called "actor model" which some people call FRP.

From my point of view, actors are for FRP what a for-loop is for imperative programming. They are a low-level primitive that can be used to build reactive systems. Each actor can receive and send messages asynchronously, and they are isolated from one another - much like the simplified actors from the book.

The reason why actors are considered FRP is that they are reactive - receive messages and react to them, and that they are immutable (though, not completely - each actor can change its behaviour function as a reaction to a particular message).

It is up to the developer to build abstractions over that low-level primitive. I don't know of a library that uses CAF to implement reactive streams for C++.

As for reactive streams in general, there are a few libraries like RX for C++ (from the Reactive eXtensions project by one of the great Haskell, F# people Erik Meijer) and STLab (from Felix Petriconi and Sean Parent).

The main downside of all of them is that FRP/reactive streams have only recently started to become popular so most libraries are young which makes them a risk to use in production. RX for C++ is probably the most mature of them all.

The second downside is that all the libraries focus on different things. And it might lead you to paying for a feature that you don't need in your project with client's CPU cycles.

With all that said, I see the following options:

1) Create your own library from scratch (and later publish it under LGPL or some other free license so that we all can use it)
2) Create the reactive stream abstraction for CAF - you can create actors similar to what is shown in the book
3) Use one of the existing reactive stream libraries




265818 (11) [Avatar] Offline
#4
Dear Ivan,

thank you very much for your kind explanation and hints about possible options.
I got deep into RxCpp and Rx. While Rx is quite an impressively good library, its implementation in C++ is rather lacking: both the documentation and the actual code do cover only a small percentage of the original Rx library.
I know that implementing my own reactive streams library would be the ideal choice, but ...: due to mismatch between my requirements and existing libraries, I had to already implement most of my own numerical linear algebra library, and I'm now implementing my own deep learning library for which the functional reactive approach would be optimal....
So... having to implement also my own reactive streams library seems to me too much, at the moment.
Any other options? ahaha...
Marco
265818 (11) [Avatar] Offline
#5
This issue "Future of RxCpp" already publish more than 40 days ago makes me thinking :
https://github.com/ReactiveX/RxCpp/issues/439
"If you compare development with the other reactive libraries, I get the impression rxcpp is dying. This is a shame since in my opinion there is no alternative in the world of C++"

And matches with my impression.