5 ms·
I still don't understand what all the hype is about pure functional programming. Sometimes mutations are useful. There are lot of good programming design patte
by stcredzero 10y ago
I still don't understand what all the hype is about pure functional programming.
Sometimes mutations are useful. There are lot of good programming design patterns which depend on mutations.
Study the Chomsky Hierarchy and the Theory of Automata. < https://en.wikipedia.org/wiki/Automata_theory https://en.wikipedia.org/wiki/Automata_theory > Here it is in a nutshell:
Languages are synonymous with computation. These can be divided into just a few types, based on how they can use state. One can observe that the complexity of an automata and its corresponding language increases dramatically with its use of state. (Turing Tarpit https://en.wikipedia.org/wiki/Turing_tarpit https://en.wikipedia.org/wiki/Turing_tarpit) You can avoid complexity by avoiding complex interactions with state.
Also, always copying objects by value every time you call a function seems very expensive
In the case of parallel/concurrent computation, it can be the less expensive option. < https://mechanical-sympathy.blogspot.com/2011/07/false-sharing.html https://mechanical-sympathy.blogspot.com/2011/07/false-shari... > As always, the devil is in the details, and it's all about context. So you are correct. Sometimes mutations are useful. However, sometimes, you can get a benefit from avoiding them.