April 1, 2026
OCaml meets C++, memes ensue
A new C++ back end for ocamlc
OCaml now spits out C++ — some cheer, others cry “unreadable”
TLDR: OCaml’s compiler can now output C++ code, promising cleaner integration with the broader C++ ecosystem. The community is split between excitement and skepticism about whether the generated code is truly readable, with bonus drama: optimization tips, name-dropping a programming legend, and a meme about Jane Street driving the laughs.
OCaml’s main compiler (ocamlc) just learned a new trick: it can now turn OCaml programs into C++ with a single flag. Think of it as a translator between two languages—OCaml (a niche favorite in finance and research) and C++ (the industry workhorse). The pitch: more readable, more idiomatic C++ than the old C output used by the runtime and “foreign function interface” (the plumbing that lets OCaml talk to C). The crowd? Oh, they had thoughts.
The loudest split: one camp is thrilled, calling it “brilliant,” while skeptics roast the claim that the generated code is “idiomatic, readable C++.” One user flatly replied, “I disagree,” sparking a mini flame-war over whether the output looks like human-written C++ or a wall of templates. Another commenter dropped a nerd-bomb about tail-call optimization—explaining that you might need to refactor functions to avoid crashing the stack—turning the thread into a crash-course for anyone brave enough to peek under the hood.
Then came the memes. Someone wondered if this was the work of that Stephen Dolan (“mov is Turing complete” legend), and another delivered the viral jab of the day: “She (Jane Street) is not gonna notice you, bro,” poking fun at devs hoping the finance giant (famous for OCaml) is watching. Meanwhile, a happy camper chimed in with pure joy: “This made my day.” The vibe: progress meets pedantry meets prime-time tech snark. For the curious, here’s what OCaml is: OCaml. And yes, C++ is this one.
Key Points
- •A patch adds a C++ backend to ocamlc.
- •The backend is presented as an improvement over the current C used by the runtime and FFI.
- •An OCaml prime-number example is used to demonstrate the process.
- •Compiling with "ocamlc -incr-c primes.ml" generates a C++ file (primes.cpp).
- •The generated output is described as idiomatic, readable C++ and includes template-based structures.