kostonstyle

kostonstyle

Reactive in Elixir

Hi all
In those days a lot people is talking about Rective Programming.
I want to ask, does elixir support the pattern too?

Thanks

Marked As Solved

josevalim

josevalim

Creator of Elixir

Which kind of reactive programming are you asking about?

If you are referring to the the Reactive Programming as in the Reactive Manifesto, the manifesto is seen by many as mostly a marketing spin on patterns that Erlang and the Erlang VM have been doing for almost 3 decades. And Elixir inherits all of that. For example, you use supervisors for resiliency, Erlang’s preemptive processes allows us to better predict latency and therefore responsiveness, etc. Even when we look at key aspects, such as being as event-driven, in Erlang/Elixir is part an integral part of the language and of the runtime via message passing, instead of something bolt on top.

However, if you are referring to the reactive programming related to data flows, as seen in Excel spreadsheets or language like Elm, Elixir has limited supported. Projects like GenStage and Flow are starting to explore such areas but there is a lot more to learn and work on.

11
Post #2

Also Liked

josevalim

josevalim

Creator of Elixir

In my early talks about data flows and parallel processing in Elixir, Rx was constantly mentioned as a reference. The goal was to have functions that introduce state or asynchronicity in the Stream module. But in order to have async or state, we need processes and then we need to think about supervision trees. At some point it became clearer Rx/Stream was not the way to go and we focused more directly on what became GenStage today. Unless I am mistaken, I briefly explored those topics in ElixirConf EU 2015 (in Krakow).

When going from Streams to Flows in Elixir, we are going from lazy+purely functional to async+parallel. There is definitely a gap in there, which are collections that are async or stateful but not yet parallel. That’s where Rx would fit in.

While I am not confident it is a gap worth exploring, given we have Streams and Flows at the boundaries, an Rx like system could (should?) be implemented using GenStage, as it would transparently handle most the data exchange concerns.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

There was another thread about this question recently, you may want to look there: Is Phoenix 'Reactive' like the Play framework?

bryanjos

bryanjos

I guess somewhat related, I’ve been wondering for a while what an Rx library in Elixir would look like.

Where Next?

Popular in Discussions Top

WolfDan
After doing a port from a c++ library to my project in phoenix I’ve seen that I need a faster way to run this algorithm and I found this ...
New
mmport80
I have put far too much effort into Dialyzer over the last year or so - and basically - I doubt it’s worth the effort. It’s not as easy ...
New
mmmrrr
Just saw that dhh announced https://hotwire.dev/ Is it just me or is this essentially live view? :smiley: Although I like the “iFrame-e...
New
fireproofsocks
This is more of a general question, but I’m wondering how other people in the community think about the pattern matching in function sign...
New
tmbb
This is a post to discuss the new Phoenix LiveView functionality. From Chris’s talk, it appears that they generate all HTML on the serve...
342 18146 126
New
fireproofsocks
I’ve been working on an Elixir project that has required a lot of scripting. I usually reach for Elixir because I like it more (and in th...
New
wmnnd
The Go vs Elixir thread got me thinking: Would it be too hard to implement a simple mechanism for creating Go-style static app binaries f...
New
AstonJ
If so I (and hopefully others!) might have some tips for you :slight_smile: But first, please say which area you’re finding most challen...
New
Owens
Hello all, I am developing a new mobile app with Flutter frontend and Phoenix backend. The mobile app has real-time task management and c...
New
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New

Other popular topics Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126479 1222
New

We're in Beta

About us Mission Statement