News for hackers. Stuff that matters.
Re:Total Functional Programming (2004) [pdf] by diggan on Thursday March 07, 2024 @07:40AM (#39628362)
As you say, you cannot make a 100% side-effect free program, unless it doesn't do anything at all.

But I do think it's valuable to aim for as side-effect-free as possible, and concentrate the statefulness into certain part(s), rather than spread out all over the place, which is the typical way typical.

Re:Total Functional Programming (2004) [pdf] by btreecat on Thursday March 07, 2024 @07:51AM (#39628451)
Practicing software architecture should generally lead you to minimize side effects and efficiently manage sections of state small enough to fit into your working memory IMO.

FP can be used to get you there, but it strongly optimizes for readability of experts in most cases which harms readability in general, as there are always fewer experts.

At least that's been my experience with FP languages in the professional space. People often underestimate the benefits of good tooling, a large community, and deep candidate pool.

Re:Total Functional Programming (2004) [pdf] by epgui on Thursday March 07, 2024 @08:56AM (#39629102)
> it strongly optimizes for readability of experts in most cases which harms readability in general

Strongly disagree. In the way you speak of "readability", you're confusing simplicity and familiarity, which are really two different things.

If FP if not "familiar" to you, then it will require some effort on your part, sure. But you can teach FP to an absolute beginner, and they will likely find it just as simple, if not simpler, than an imperative mode of reasoning. It's basically just a social and cultural issue at this point.

Re:Total Functional Programming (2004) [pdf] by sodapopcan on Thursday March 07, 2024 @09:41AM (#39629651)
Very much so to all of this. When I started programming I was just messing around and doing so as more of a curiosity than anything. What I came up with on my own was much closer to FP. When I started to really learn and was presented with OO, it took me what felt like a really embarrassingly long time to under how classes worked and why I'd want them. Once I grokked it I had a grand ol' time, but then I learned a functional language and it felt so good to learn an actual well-designed version of how I initially imagined programming should be :)
Re:Total Functional Programming (2004) [pdf] by lupire on Thursday March 07, 2024 @10:54AM (#39630553)
No programming languages have side effects. Side effects are introduced by the runtime.

All programming languages have side effects. The question is what logical constraints limit them.

Re:Total Functional Programming (2004) [pdf] by garethrowlands on Thursday March 07, 2024 @12:07PM (#39631406)
Absolutely.

It's often helpful to distinguish between effects and side-effects. The idea is that an effect is deliberate and explicit, such as, say, sending an email or moving a robot's arm. Whereas a side-effect is one that happens but wasn't your explicit objective - heating the CPU, say, or silently caching a value in thread-local storage. Haskell programs often use the type system to make these kinds of distinction.