3 ms·
It's interesting that functional programming is becoming more popular while functional languages are straggling behind a bit, but I think there's a contributing
by overgard 8y ago
It's interesting that functional programming is becoming more popular while functional languages are straggling behind a bit, but I think there's a contributing factor besides just imperative languages borrowing features: IO & error handling. What I find with functional languages is that once I start adding in a lot of IO and error handling things get gross really quick, ie things like print statement debugging are a "side effect", along with things like logging, and so on. If I was more of an expert in functional languages maybe I'd find a more elegant way around this, but I guess I find using something like python I get most of the benefits of a functional language without the aforementioned things becoming painful.
From a practical standpoint, debugging by setting things like breakpoints and watching a value also becomes a bit more weird, because you have so many return values being pipelined through multiple functions without ever having an alias assigned to them, so how do you add a watch? Of course there's ways around that, but I wonder if dealing with practical problems like that turns a lot of people off. Especially since one of the things that draws people to write functional code is it's elegance, but it stops looking so elegant once you have a lot of these concerns in place.
- iamnothere 8y agoI think both models have their strengths. I use C# quite a bit (which itself borrows some functional paradigms for LINQ, Func, etc), but it definitely has some limitations, especially when you need immutability. I have started using F# to fill these gaps, and thanks to the CLR interop is pretty easy. Debugging is pleasant as well. Someone else mentioned Python/Coconut, which is another great combo that enables you to switch between functional and imperative styles as needed. I think this will probably become more common, especially in interpreted languages.
- nikonyrh 8y agoI have found great joy with Clojure (runs on JVM) which doesn't constrain you from side-effects, it just encourages you to do them on an appropriate functions. And all values are immutable by default. Debugging pure functions is quite a lot different than keeping watches on specific memory locations (or variables).