3 ms·
For a start when we're talking about closures versus objects, we're not necessarily talking about true functional programming. Closures can have and manipulate
by btilly 13y ago
For a start when we're talking about closures versus objects, we're not necessarily talking about true functional programming. Closures can have and manipulate internal state. Pretending that they don't ignores real world usage where they do.
However let's limit ourselves to functional techniques. Whenever someone talks about something in the very abstract and says "easier to reason about" I mentally insert "for you". Certainly it isn't true for everyone or every situation.
A basic principle in programming is that starting at the hardware level we build abstraction layers that let us think about things in higher level ways, hopefully ultimately in a way that matches the terms that the end application uses. End applications have concepts like account balances, user status, and other such stateful pieces of information. If you're going to have the state, workaround that you pretend you don't, you will cause confusion. Pick your favorite 5 Monad tutorials for proof.
Consider as an example the use case, "Provide a form to let us mark spammers, and block them from our site." For all the theoretical advantages of avoiding state, this is going to be easier to model in a system where users have a piece of state known as is_spammer.