23 ms·
Basically anything written in erlang or elixir follows this paradigm. It's really extremely productive to code this way... I wrote a job scheduler from scratch
by dnautics 8y ago
Basically anything written in erlang or elixir follows this paradigm.
It's really extremely productive to code this way... I wrote a job scheduler from scratch in 3 months and never once had to write or use a mutex or semaphore. Immutability makes you very confident about your code.
Similarly, my UI guy wrote a UI in basically functional react. It's amazing. With very little js experience I made code patches that.. just worked because I was guaranteed that no function calls had mysterious side effects...
- lackbeard 8y agoKnow of any good open-source examples?
- PhearTheCeal 8y agoRabbitMQ
- dnautics 8y agoRiak? Couchdb? I know there's a lot of Phoenix examples out there but it obscures some of the key points in fp. I'd show you my code, but it's closed source atm. For a fp react example: https://github.com/streamproject/cryptopotamus-web https://github.com/streamproject/cryptopotamus-web
- mmartinson 8y agoAgree that Elixir and Erlang lend themselves well to this style, but I strongly disagree that everything written in them does or that the languages help enforce this pattern in any way. It's quiet the opposite really from what I've seen. Elixir places absolutely no constrains on when and how IO happens, and provides extremely useful primitives for shutting state between (VM) processes in otherwise stateless code. A library function that looks totally pure could, for example, boot an entirely different subsystem that fired a missile into the sun before providing a return value and you'd never know it if you didn't read the docs, or use one of many pieces of fantastic beam tooling to inspect the runtime state of the system. This is part of what makes these languages pragmatic to work in. There are foot guns everywhere, but the VM ensures you sign into the foot gun registry whenever you use them.