Re:What are potential disadvantages of functional programming?
by seanmcdirmid on Thursday July 27, 2017 @07:53PM
(#14870838)
Pragmatically speaking, most non trivial programs consist of functional and, yes, even object-oriented styled code. Doing functional programming over those nounish state-indexed things doesn't make them non objects even if you prefer to call them "entities" instead, while most OOP programmers use lambdas freely without any feelings of regret.
[ Parent
| on HN ]
Re:What are potential disadvantages of functional programming?
by eyelidlessness on Thursday July 27, 2017 @08:29PM
(#14870996)
The thing about OOP that is avoided in FP isn't calling an entity an "object", it's the fact that the same object changes over time. It's hard to reason about "I let this so-called function change a thing and I can't know how or why". It's much easier to reason about "I gave this function a piece of data and it gave me the change back".
Re:What are potential disadvantages of functional programming?
by seanmcdirmid on Thursday July 27, 2017 @08:34PM
(#14871007)
Entities externalize state that can vary over time. So it isn't f(g) but f(g(t)). Time (and hence mutation) really does exist, whether it is implicit or explicit.
It is only easier to reason about when the data you give the function is limited. You can always pass the world into the function and take it as an output, then it no longers matter. Effect systems are also possible with objects as well, they just aren't a feature of functional languages.