Hacker News new | past | comments | ask | show | jobs | submit login

Almost all modern statically typed languages have closures, higher-order functions/methods, lazy streams, and combinators that run efficiently. Persistent/immutable data structures can be implemented even in C.

Also, OCaml has no tracking of side-effects (like in Haskell), and the language and the standard library have lots of features and functions with mutation, such as the array update syntax, mutable record fields, Hashtbl, and the regex module.

The only thing that makes OCaml more “functional” than e.g. Dart, Java, or Rust is that it supports tail calls. While having tail calls is important for functional programming, I would happily give up on tail calls if that means not having the problems listed above.

When you mix imperative and functional styles tail calls become less important. For example, I don’t have to implement a stream map function in Dart with a tail call to map the rest of the stream, I can just use a while or for loop.

In my opinion there is no reason to use OCaml in a new project in 2023.




You might want to make it clearer that this is a literal quote from the last paragraph of the article. Are you posting this because you agree/disagree?




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

Search: