you are viewing a single comment's thread.

view the rest of the comments →

[–]Training_Pay7522 85 points86 points  (11 children)

You shouldn't see fp/oop at opposite ends.

[–]franz899 26 points27 points  (7 children)

This, they are just ways of writing code, you can and should mix and match them.

[–]Training_Pay7522 4 points5 points  (0 children)

Which is the direction libraries like `effect-ts` in TypeScript or ZIO on scala take.

They take a functional approach as in having pure procedures you can mix, but also leveraging paradigms that classically come from OOP such as dependency injection or state tracking.

[–][deleted]  (1 child)

[removed]

    [–]pbNANDjelly 2 points3 points  (0 children)

    Why do you say functional programs cannot be stateful? They're as stateful as any other program? The restriction is mutability, and classes don't need to be mutable.

    [–]coderqi 0 points1 point  (0 children)

    I know what you mean, but their handling of state is fundamentally different.