I think he’s far too quick to dismiss the idea of no side effects. Or rather I think he’s taking an absolutist stance. The problem isn’t so much the side effect as it is the ability to introduce side effects arbitrarily with no warning to someone using your functions. To be fair I think the only relatively mainstream language that actually does something about this problem is Haskell with the IO monad (and to a much lesser extent Rust via unsafe). Just as Rust tackled the problems of concurrency through the language concept of ownership I think there’s room to tackle side effects at the language level as well. Haskell does it one way, but there’re potentially other approaches that could achieve the same goals in a hopefully slightly more approachable manner (insert monads are a endofunctor in the category of copypasta here).
Related to the idea of no side effects I think it’s also really important to call out the concept of total functions, something it’s incredibly hard to reason about in most languages but that’s trivial in Haskell and not totally horrendous in Rust.
The problem isn’t so much the side effect as it is the ability to introduce side effects arbitrarily with no warning to someone using your functions
Yes, I try and briefly allude to this in the “caution” and “tldr2” sections, but I think I could have been more clear. You are right that for many people it’s not so much about avoiding side effects as it is about coming up with ways to use them carefully. Stateful monads and clojure’s atoms/refs were in fact what I had in mind. And debating the pros/cons of these techniques is indeed a good conversation on its own! What I mostly wanted to get across is that fp is not about programming without side effects. All the good debate is about the extent to which we should try to avoid side effects, and what techniques we should use when doing so.
I think it’s also really important to call out the concept of total functions
Yeah I think this is totally (heh) worth talking about, and a much better topic than pure functions. I only didn’t mention it because I don’t see it brought up too often.
I think he’s far too quick to dismiss the idea of no side effects. Or rather I think he’s taking an absolutist stance. The problem isn’t so much the side effect as it is the ability to introduce side effects arbitrarily with no warning to someone using your functions. To be fair I think the only relatively mainstream language that actually does something about this problem is Haskell with the IO monad (and to a much lesser extent Rust via unsafe). Just as Rust tackled the problems of concurrency through the language concept of ownership I think there’s room to tackle side effects at the language level as well. Haskell does it one way, but there’re potentially other approaches that could achieve the same goals in a hopefully slightly more approachable manner (insert monads are a endofunctor in the category of copypasta here).
Related to the idea of no side effects I think it’s also really important to call out the concept of total functions, something it’s incredibly hard to reason about in most languages but that’s trivial in Haskell and not totally horrendous in Rust.
Yes, I try and briefly allude to this in the “caution” and “tldr2” sections, but I think I could have been more clear. You are right that for many people it’s not so much about avoiding side effects as it is about coming up with ways to use them carefully. Stateful monads and clojure’s atoms/refs were in fact what I had in mind. And debating the pros/cons of these techniques is indeed a good conversation on its own! What I mostly wanted to get across is that fp is not about programming without side effects. All the good debate is about the extent to which we should try to avoid side effects, and what techniques we should use when doing so.
Yeah I think this is totally (heh) worth talking about, and a much better topic than pure functions. I only didn’t mention it because I don’t see it brought up too often.