3 ms·
> & aims to avoid side effects by using pure functions I think this has always been an incorrect framing. Functional programming does not _avoid_ side effects
by amw-zero 3y ago
> & aims to avoid side effects by using pure functions
I think this has always been an incorrect framing. Functional programming does not _avoid_ side effects purposefully. It simply doesn't have them without explicitly modeling state, because it's based on math and logic which are stateless at their foundation. That's it.
We only bring up state because of how closely all of our languages are tied to stateful CPU designs - and for good reason btw, seeing as that's how all of our processors have been designed for all of the history of modern computing.
Said another way, functional programming doesn't try to do anything, it simply computes in a different way.
- pharmakom 3y agoImperative programming: write instructions for the computer to follow. Functional Programming: model the instructions that you want the computer to follow. Subtle difference. A model can be manipulated by other code in interesting ways.
- danmaz74 3y ago> We only bring up state because of how closely all of our languages are tied to stateful CPU designs I would rather say that we bring up state because almost all practical applications of computers have state to manage - to be honest, I can't think of many which don't have state.