3 ms·
Erlang and Elixir are what could be called pragmatic FP. The idea is that your base abstraction should be functional, you can then have a genserver for that ab
by el_oni 3y ago
Erlang and Elixir are what could be called pragmatic FP.
The idea is that your base abstraction should be functional, you can then have a genserver for that abstraction which is stateful.
So let's take lists for example. Building up a list is functional. But I could have a ListServer which takes an item and prepends it to a list. And just holds on to that. So lots of processes can send it messages to add things in, and order in the list is determined by order the messages arrived.
The way the server manages state is
State -> function -> State'
And those functions are easy to test.
It makes for a nice experience building software, the default is functional and you drop in processes which hold state when you need them. Compared to classes where the default is state.