Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the status of Functional Reactive Programming in Python?

I've found this paper ("Practical Functional Reactive Programming") , the authors (as far as I understand) try to create an FRP library in Python in the spirit of Yampa.

I've also found these interesting slides featuring SPJ! The slides seem conclude that it is not so easy to implement FRP in a dynamically typed language - unfortunately the bullet points in those slides do not really explain why.

Why are there, apparently, not so many FRP implementations in Python? Why is it more prevalent in Haskell? Is the static typing really needed for FRP? How much do we gain by static typing in FRP? Is it super essential or can one get by without it (if one is only writing a few thousand lines of FRP code)?

I really wonder, if SodiumFRP can be implemented in C, Java, Haskell etc. then what is the problem with Python?

It is relevant to note that in JS there is no real FRP implementation either at the moment (2015.08.04), so that suggests that the lack of static typing in Python is the reason, I am not convinced though, hence the question.

UPDATE: Interestingly, I've came across Flow Based Programming in Python. How do FBP and FRP relate to each other ? They only seem to differ just a little bit, at least, I have that first impression when I compare the bottom of the acronyms' middle characters.

like image 583
jhegedus Avatar asked Sep 04 '15 04:09

jhegedus


People also ask

What is reactive programming in Python?

Reactive Programming is a programming paradigm oriented around data flows and the propagation of change. This means that, when a data flow is emitted by one component, the Reactive Programming library will automatically propagate those changes to other components until it reaches the final receiver.

Is reactive programming functional?

Functional reactive programming (FRP) is a programming paradigm for reactive programming (asynchronous dataflow programming) using the building blocks of functional programming (e.g. map, reduce, filter).

Is reactive programming the future?

Reactive Extensions (Rx) are similar to Future. Future can return an independent element, while Rx returns a stream that can be subscribed to. The same set of specifications is supported on different platforms.

Is functional programming same as reactive programming?

Functional programming paradigm is built upon the idea that everything is a pure function. Reactive programming paradigm is built upon the idea that everything is a stream observer and observable philosophy.


2 Answers

"The Reactive Extensions for Python (RxPY)" is imho coming closest to FRP with Python.

like image 181
Red Pill Avatar answered Oct 09 '22 10:10

Red Pill


There is also aioreactive, which utilizes newer language features such as async/await.

like image 40
Rotareti Avatar answered Oct 09 '22 11:10

Rotareti