4 ms·
> In terms of informal reasoning, the benefits of lack of internal (to a function) mutable state are essentially zero, or better worded, lack of local mutable s
by mercurial 12y ago
> In terms of informal reasoning, the benefits of lack of internal (to a function) mutable state are essentially zero, or better worded, lack of local mutable state increases the complexity of a function. It's not like your state doesn't change if you use recursion and immutability... it certainly does, it just mutates transiently while you are building up your result. That's often more difficult to reason about than a typical imperative solution with mutability.
But you can have local mutable state in OCaml using refs... In fact, that's exactly how the gen library works (hide a ref in a closure). That said, I find it easier to understand a sequence of maps/folds/filters than figuring out what a for loop is supposed to represent.
> Okay, fine, perhaps I am a shit developer who simple isn't smart enough or lacks the experience, but the reality is when you are working on a team, the chances are that you will have a very difficult time gathering 20, 30, or more solid functional developers let alone that many OCaml developers. Ideally, you want your team to all be at least competent in the language you are using and that's harder to achieve with OCaml.
That's a fair point. On the other hand, it's very difficult to find good imperative programmers anyway, and I find that it's more difficult to shoot yourself in the foot with OCaml.