Hello to everyone, I am new at this group. My short background: software developer in several areas (embedded systems, web development, compiler construction, simulation systems, etc.) in many different languages in industry and academia.
(As a new user I was only allowed to mention a maximum of two links in this post. I intended to post links to all interesting topics. Sorry for the inconvenience!)
I have been using OCaml happily for years now, and I understand some of the criticisms. However, in my case a lot of them faded away since I began to use OCaml in a “classic” way, which means to avoid too much terseness, and to use syntactical means to avoid ambiguity (using redundant begin … end or (…) in particular). I also use “;” and “;;” more than actually needed to avoid ambiguity. I favor a “KISSS” principle (KISS with three “S”) in OCaml: “Keep it simple, stupid AND safe”
Now, I would like to add some points to the post and the comments made here:
Regarding PPX, there is an alternative called MetaOCaml, a variant of OCaml which supports (typesafe!) macros like Lisp. It’s really nice and usable. However, I realized that I had much less (actually NO) need of any macro in OCaml so far.
Regarding FFI, ctypes make C-bindings MUCH easier. See Type-safe C bindings #1: Using ocaml-ctypes and stub generation | Skylight Symmetry
Regarding the ecosystems JVM and dotnet, there exist OCaml bindings called OCamlJava and CSML.
There is also JS_of_OCaml which compiles OCaml bytecode to Javascript. That means the WHOLE OCaml language is usable in the Javascript world. There is also a syntax variant called Reason for those who dislike pure OCaml.
Anyone who is seriously interested in OCaml should take a close look at “Awesome OCaml” (at github). It presents a curated list of many things related to OCaml.
For newcomers, I strongly recommend Prof. Michael R. Clarkson’s fabulous lecture “OCaml Programming: Correct + Efficient + Beautiful” at OCaml Programming: Correct + Efficient + Beautiful — OCaml Programming: Correct + Efficient + Beautiful . The book is free and accompanied by a series of 200+ short video clips. They expose how beautiful OCaml code actually can be. They also explain how unit tests and formal verification can be included seemlessly in OCaml programming.
One of the first points newcomers (in particular those who come from C-like languages) MUST understand is the semantics of semicolon in OCaml. They do NOT behave as in C but they are a completely different thing. In OCaml, single semicolons are just delimiters of list elements, and double semicolons are required wherever groups of code need to be separated. Believe it or not, this was my very first stumbling block when I began to dive into OCaml. Thanks to the nice OCaml community I was able to realize and fix the problem very quickly. My general advice: Enclose EVERYTHING in parens (…) or in begin … end which belongs together, otherwise you can get into trouble easily (dangling else etc.).
Happy coding!
Ingo