4 ms·
No, it doesn't need to be all or nothing, but the scenario I was directing my point at was where people try to "do FP in lang X", not just sprinkling in functio
by xwowsersx 3y ago
No, it doesn't need to be all or nothing, but the scenario I was directing my point at was where people try to "do FP in lang X", not just sprinkling in functional concepts here are there. At this point, almost every language has some functional programming concepts in it, but I wasn't addressing that. I could've been clearer, but I've seen many cases where people would rather be programming in Haskell or some other functional language and then when "forced" to use some other language, like Python, they try to essentially recreate Haskell in that language and my point is that this really doesn't work or, at the very least, it's more trouble than it's worth and the resulting codebase is a complete mess because you've tried your hardest to do FP in a language that ultimately isn't suited for it. You are absolutely right though that it needs not be all or nothing. To the extent you can rely on some of these constructs and enable equational reasoning by avoiding mutation, etc. you'll be better off, no doubt (I do this too in Python and other languages because wherever I can make it easier to reason about my code, I will do so). I'm just cautioning against trying to do something akin to pure FP in Python.
- jgilias 3y agoThis I agree with completely! I’m a big believer of “when in Rome”. As in, try to be idiomatic in whatever language you need to use. I once saw a Python codebase where someone had tried very hard to write Java in Python.. That was equally horrible!
- xwowsersx 3y agoExactly. Java in Python sounds scary :)