Re:Pretending OOP Never Happened
by devericx on Friday May 15, 2020 @05:58PM
(#23197996)
How does functional programming allow you to avoid reasoning about state? Don't you always have to reason about state, no matter what paradigm you use? Otherwise, how are you going to build anything useful if you're not keeping track of any variables?
[ Parent
| on HN ]
Re:Pretending OOP Never Happened
by AnimalMuppet on Friday May 15, 2020 @08:30PM
(#23199186)
The following words are bad: shared, mutable, global.
All programs have state. It's worse if the state is shared. It's worse if the state is mutable. It's worse if the state is global. It's the worst if it's all three.
Functional program still have state. They typically don't have shared state, or mutable state, or (much) global state, though. Those are real wins.
I feel like a lot of functional programming tries to hide state behind an OS/API call of some sort. Sometimes that makes sense. Think a program that transforms data into SQL calls.
Mirror of that is a driver for a piece of hardware. You got multiple levels of state going on.