Tech News
← Back to articles

I chose OCaml as my primary language

read original related products more articles

I started using the OCaml language regularly around 2012, and since then, my interest and enthusiasm for this language have only grown. It has become my preferred choice for almost all my personal projects, and it has also influenced my professional choices. Since 2014, I have been actively participating in public conferences dedicated to programming and software development, where I often express my enthusiasm for OCaml in ways that may be a bit over the top (but always passionate). This has earned me, in a friendly way, the nickname OCaml evangelist — a title that, I admit, I find very flattering. Moreover, I’m not alone in thinking this. Despite the common misconception that OCaml wouldn’t be a pragmatic choice for industry, major companies such as Meta , Microsoft , Ahref , Tarides , OCamlPro , Bloomberg , Docker , Janestreet , Citrix , Tezos , and many others actively use it.

In this opinion piece, I will try to briefly share my encounter with the language and list its advantages — organized into several sections covering the language itself, its ecosystem, and its community. I will also attempt to debunk some popular myths (or misconceptions) found on the Internet. For the sake of transparency, it is important to note that, at the time of writing, my professional work involves working for and on the OCaml ecosystem. However, readers who have followed me for several years can attest that I was promoting the language long before I was paid to work on the OCaml ecosystem, sometimes rather immoderately.

Foreword

First, this article will explain why I personally believe that OCaml is a relevant choice in many contexts. My goal is not specifically to convince you—although that would be a very welcome side effect — and it’s quite likely that many of the arguments I present will also apply to other languages!

Also, very often, when I suggest OCaml to people who want to explore new languages or try out solutions written in OCaml, I’m kindly told that I’m always promoting OCaml. It’s amusing to notice that when the suggestions involve languages adopted by default, like JavaScript, or more recent ones like Rust or Go, they tend to trigger fewer reactions. This is probably because people implicitly assume that proposing a lesser-known language leans toward irrationality and personal preference. From my point of view, suggesting OCaml is, in many cases where fine-grained memory control is not needed, just as relevant as suggesting Rust (and probably more so).

To wrap up this preface, many people first encountered OCaml (or Caml Light) during their undergraduate studies or in preparatory classes, often using it in contexts far removed from industry. As for me, I started getting interested in OCaml much earlier, thanks to the Site du Zéro, where a small community of functional programming enthusiasts promoted less mainstream languages like OCaml, Erlang, and Haskell. My interaction with OCaml at university was just a bonus.

Other resources

I’m not the first to document the reasons for choosing OCaml. There are many other resources that, in my opinion, are also worth checking out, and they show that OCaml users are generally very satisfied — so much so that they’re motivated to share how and why we chose the language as our main technology:

There are probably other resources and testimonials, notably on the official website, which features both industrial and academic case studies. There are also articles expressing the frustration OCaml can cause. I’m aware that OCaml is not perfect—nor do I believe any technology is perfect. I’ll likely refer to some of these articles (implicitly or explicitly) in the section on myths and in the conclusion, where I’ll try to explain in which contexts I don’t find OCaml to be a relevant choice.

OCaml as a language

... continue reading