Comment on [deleted]
demesisx@infosec.pub 1 year agoI edited my comment to talk about imperative vs FP rather than OO vs FP because FP can actually be OO. What I meant was imperative.
Anyway, in most functional implementations, state is usually handled by a minimal top layer. Functional paradigms are helpful in keeping the complexity to a minimum.
I like to use the functional core, imperative wrapper design style.
Lmaydev@programming.dev 1 year ago
Right yeah.
Many OO languages lean into FP heavily as well.
Pipoca@lemmy.world 1 year ago
There are really very few OO really lean FP.
The essence of FP is working with pure functions that simply map their input to their outputs without mutating anything.
To do that, you need immutability by default. Very few OO languages do that in their standard libraries. Scala comes to mind as one of the few exceptions. There’s also a bunch of FP languages that bolted an object system into them, like Ocaml and F#.
There’s a lot of OO languages that take some features like closures from FP languages, but it’s typically a royal pain to actually do anything functionally in those languages. Java and python come to mind here. Javascript used to be a huge pain, but with spread syntax it’s gone down to only moderately painful.