3 ms·
I’m not so convinced that this is a property of functional programming as much as simply good programming. I’ve seen functional programs that pass around huge d
by jahewson 2y ago
I’m not so convinced that this is a property of functional programming as much as simply good programming. I’ve seen functional programs that pass around huge data structures that couple functionality. I’ve never seen the benefit of performing elaborate monadic dances to avoid state that would have been simpler to represent in a non-functional language.
- djtango 2y agoOne benefit there if it's statically typed is that you've pushed some correctness validation into the compiler. In dynamic languages like Clojure it is far too easy to couple functionality and write implicitly imperative but superficially functional code. Something I'm guilty of because it's too easy to do and takes a lot of experience and discipline to avoid.
- jimbokun 2y agoWell this seems to me a violation of the spirit of functional programming, even if it's written in a functional programming language. Isolating state is the key principle. Philosophically you could say a program following this principle written in an object oriented or procedural language is more "functional" than a program that passes around a big tangle of state in a single data structure written in a functional language.
- jahewson 2y agoYes, indeed. That’s my point really. Functional programming only delivers its promised benefits in the hands of skilled users. We’re just not used to seeing that given that it’s at a self-selecting crowd. Lambdas, ADTs, immutability - all of these exist in non-functional languages now and it’s great! It seems to me that this may be where the bulk of the value is, rather than functional purity.