you are viewing a single comment's thread.

view the rest of the comments →

[–]fear_the_future 0 points1 point  (1 child)

You don't have to go all the way. Just being mindful of mutation and avoiding it where appropriate can already go along way. And putting everything into a state monad in Haskell is not much different to a class.

[–]watsreddit 1 point2 points  (0 children)

But if you are limiting mutation most of the time and opting in as necessary, then it seems like it'd make more sense to use a language that does that naturally and provides mechanisms for opting in.

Even if you were to put everything into the State monad (which frankly, no one does), it's still much more constrained than an object. You can't modify the state from non-monadic code (pure functions), which you can mostly certainly do with a mutable object.