5 ms·
> Functional programming languages shine when they deal with complex, recursive data structures, not for simple tasks which are primarily IO and need to handle
by denim_chicken 12y ago
> Functional programming languages shine when they deal with complex, recursive data structures, not for simple tasks which are primarily IO and need to handle many cases.
I think most of the advantages of FP languages (as they exist today) become disadvantages as your data structures get more and more complex. Efficient mutability becomes necessary. Pattern matching breaks down as (G)ADTs can no longer encode useful invariants. Referential transparency becomes useless once you realize you want explicit sharing. Laziness and space leaks become a huge PITA. The RTS and the mandatory GC start getting in your way as it gets harder and harder to eek out performance from your code. etc etc..
- avsm 12y ago> I think most of the advantages of FP languages (as they exist today) You seem to be describing Haskell with that rather overgeneral (and incorrect) statement above. OCaml supports mutation and explicit sharing just fine, and is strict by default. As for the rest, as you get closer to needing manual resource control, it just gracefully devolves.
- denim_chicken 12y agoI seem to be describing Haskell because Haskell is the epitome of an FP language. If FP is truly a self-contained practical, versatile paradigm by itself, then Haskell would exemplify this.
- mercurial 12y agoThere is no "true" definition of functional programming. You can, of course, make the argument that Haskell is the one true functional language, but this is not what is generally accepted (eg, OCaml or Erlang are usually considered functional languages - and most of these languages have strict semantics).
- denim_chicken 12y agoAll I'm saying is that if we plot languages on a spectrum, where one end corresponds to functional programming and the other to, say, imperative programming, then Haskell will be most closely to the FP end than any other practical language. Haskell embodies the most of the tenets of FP.