3 ms·
Can you elaborate on why you think purity is overrated? I find the destruction of local reasoning by impurity to be one of the biggest drawbacks of non-functio
by lgas 9y ago
Can you elaborate on why you think purity is overrated? I find the destruction of local reasoning by impurity to be one of the biggest drawbacks of non-functional languages.
- phillipcarter 9y agoI think something that is impure when it needs to be is easier for me to maintain than something that really goes out of its way to be pure. Especially when the set of cases something should handle is large. On the other hand, I think that immutable data is rarely difficult to deal with, and saves my stupid self from all kinds of bugs that I'd probably write.
- imtringued 9y agoBecause this is not a black and white matter. Lack of purity doesn't imply lack of local reasoning. A program that is 10% impure and 90% pure is not considered pure yet is still 90% easier to understand than a 100% impure program.
- ModernMech 9y agoAt the same time, when a language is 100% pure you gain some interesting abilities, like being able to rewind and replay the state of your program, or to optimize code by replacing function calls with computed values (memoization).
- setzer22 9y agoWhat stops a 90%-pure language to dectect pure functions and do the exact same optimizations? I'm not saying that is decidable in all cases (can't come up with a meaningful counter-example either), but usually a 90% good enough solution is better than a 100% solution that makes you go out of your way to do very simple things (like print to stdout).
- ernst_klim 9y agoI think the opposite. I feel that OOP had become such a mess exactly because of those ``compromises'' which were made in mainstream OOP languages (i.e. java, c++ etc). I expect the same from mainstream FP implementations. Such ``compromises'' just ruin the whole carefully elaborated framework of the paradigm introducing breaches, which would be filled with workarounds. And voila, meet new java.