this post was submitted on 09 Oct 2025
3 points (80.0% liked)

Functional Programming

1591 readers
1 users here now

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] mrh@mander.xyz 2 points 1 month ago* (last edited 1 month ago)

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.