Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Functional programming languages haven't gone mainstream but functional techniques are very common now.

Higher order functions, immutable data structures, declarative UI frameworks, etc are things you're quite likely to encounter in a contemporary codebase these days.



That's what I said. I do use functional programming techniques, I just wonder why functional programming languages don't see a larger following.


Good question. I suspect it's because the downsides of losing the larger ecosystem of more mainstream languages outweigh the upsides of a functional language. The libraries, package managers, tooling, runtime, debuggers, documentation, and editors etc just aren't anywhere near as mature for Haskell or Ocaml as they are for Typescript or Python, for example.


Debugging is a known sore point with OCaml for example. But what is the problem with the Haskell RTS or the OCaml runtime? Why is it not “anywhere as mature” as Python’s or something like Node for JS?

Python’s had the GIL while Haskell has had a well functioning parallelized runtime for a long time. And both Haskell and OCaml’s runtimes outperform Python’s and are on par with Node.[1]

As for documentation, every time I come back to Hoogle,[2] I remember how I miss it in other languages that just don’t have anything similar going. The lack of types doesn’t help, and reading the documentation of the Python standard library or a popular library like torch is sometimes like solving a puzzle because it’s unclear what a function or a class constructor really does or even what class’ instance it returns.

[1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/... for CPU usage but their memory usage is comparable too, and OCaml’s benefits from the language’s eagerness.

[2] https://hoogle.haskell.org/


I didn't get anything close to that from your original message. I thought you meant "I write functional JS, but am wondering why a language like clojure or OCaml isn't more popular"


Inertia of languages like Java, C, C++, C#, etc. due to university and existing projects. Also managers wanting a huge recruiting pool.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: