Why do so many feel so strongly against state?

In my 10+ year programming career not once have I ever wished something was functional. State simply is, dealing with it is a foundational concept in writing code.

"It's harder to test" -- so mock it in the tests.

"It's harder to reason about" -- you can see the references in your code and you can punch it into the debugger. If the state is implicit it is mentioned in the documentation that you've read right??

"It's hard to tell where changes come from" -- again, stepping through with a debugger makes this somewhat trivial. Find the line that turns state bad, then drill into whatever that line calls, repeat.

I'm not saying we should be adding external state willy-nilly. But it is hardly evil -- the dumb hacks that have appeared when a class or instance var would have done the trick boggle the mind.

Can someone please prove to me how FP isn't just another cargo cult?

You may be misunderstanding the relationship between FP and state.

We are not against state, quite the opposite, FP likes state so much that we put it on a pedestal! We make it explicit, often with functionality that makes it easy to spot, understand, and manipulate.

If you think about your questions, here is how I would answer it:

"It's harder to test" -- so let's make them simple to test without mocking them out (which would effectively remove them from the test).

"It's harder to reason about" -- so let's make it easy to reason about by making it explicit.

"It's hard to tell where changes come from" -- so let's add constructs for manipulating it.

It is not about antagonizing it, it is about making sure it is clear and intentional.

---

PS: the "evil bit" is more often associated to global mutable state, but don't let any FP language fool you, they all have global mutable state with explicit tools for manipulating them. In Elixir, you can even use tools such as LiveDashboard [1] to navigate all global mutable state in your application, making it very easy to introspect.

[1]: https://github.com/phoenixframework/phoenix_live_dashboard/