A couple of people have asked why you might choose OCaml over other languages. I've not done as much OCaml work as others on this thread (I work primarily on ReactJS (Facebook/Instagram's) functional UI framework), but I can offer a different perspective as someone who is outside of the OCaml community, but asking the same questions. Here are some of my personal findings.<p>I'll narrow any comparison down to the ML family of languages. Java/C++/ and many other languages are just now beginning their slow, but inevitable evolution into <i>becoming</i> a dialect of ML (which IMHO is a sort of admission of the ML/functional family superiority).<p>Once you embrace the power of pattern matching, it's hard to use anything but an ML family language (StandardML/Haskell/F#/OCaml). I would program in any one of those languages over Java/C++/Objective-C/JS.<p>Practical reasons why you might choose OCaml:<p>- OCaml's records aren't as elegant as SML's but OCaml has labeled arguments with optional default values which can satisfy many of the reasons why you'd use records as arguments in the first place (and may be even more powerful in some cases).<p>- Two modes of compilation (fast native executable XOR fast compilation). Who doesn't like options.<p>- All the benchmarks I can find show that OCaml is very fast (around as fast as C++).<p>- Excellent JS target and and apparent commitment to maintaining it (as someone building a JS library, this is very important to me) (and as someone who wants to build apps and be able to instantly share them with everyone in the world.)<p>- Someone has built an autocomplete plugin for Vim/Emacs (merlin). ("VimBox" (<a href="https://github.com/jordwalke/VimBox/" rel="nofollow">https://github.com/jordwalke/VimBox/</a>) has configured it to complete as you type - like in Visual Studio etc.)<p>- On very rare occasion, you'll run into a problem that is inherently better suited to OO (dynamic dispatch). I can usually find a way to solve it with functors/modules, but it's nice to know that you have OO in your back pocket in case you ever need it. It's also nice to know you probably won't have to.<p>- Finally, a common package manager (OPAM) is becoming standard. I look forward to seeing how OPAM helps make the new dev experience and the code-sharing/development experience seamless.<p>- The module system is very powerful (SML's). Haskell does not have this, and strangely F# dropped it. (I hear, Haskell's type classes fulfill similar roles (but with more sugar)).<p>- There's usually ocamlyacc grammars for most languages. Most examples of languages, type systems, parsers are already in OCaml (or ML). It's a nice (but small) perk.<p>- Predictability. OCaml is not lazy by default. Lazy computations could become problematic for low-latency applications (such as UIs) if a lot of computation becomes is deferred until the moment a final dependency has been satisfied, but by that time you may be close to your screen refresh deadline and it may lead to a dropped frame. It would have been better to have been computing while waiting for a final dependency. I'm not sure if Haskell (a lazy language) has had this problem. You can opt into laziness in OCaml if you would like to.<p>- Mutability. I feel strange saying this, as such a huge proponent of immutability, but sometimes you just need to hack something in place, mutate some state and come back to clean it up later. (You can still use monads in OCaml).<p>- Tagged Variants (no need to predeclare variants, just pattern match on them and OCaml ensures that only properly matched values ever make their way into that expression).<p>- Industry use is growing. OCaml is used here at Facebook and many other places as mentioned.<p>- There are many abstractions to choose from (Records, Objects, Modules, Functors, First Class Modules, GADTs, ...).<p>OCaml Cons:
- There are many abstractions to choose from (Records, Objects, Modules, Functors, First Class Modules, GADTs, ...).<p>(Edited for formatting)