2 ms·
> OK, that's basically a static method in C#. Is that wrong? Yes, that is wrong. Static methods don't have access to object state, but they can still access mu
by dragonwriter 8y ago
> OK, that's basically a static method in C#. Is that wrong?
Yes, that is wrong. Static methods don't have access to object state, but they can still access mutable state (e.g., static data members) and invoke other side effects, so its results can depend on things other than the arguments.
> > Functional programming, therefore, is programming so as to avoid these side effects wherever possible.
> So functional programming should never handle state?
“Wherever possible” is not the same as “everywhere”.
> Do you just move that logic into another framework (Angular, React, etc)?
No, though pure languages generally do something loosely similar; Haskell programs, can be viewed (in one interpretation of values in the IO monad) as having a main function that produces an imperative program as the output, which by convention the runtime executes.