Has anyone tried this and blogged about it?
I haven’t delved into OCaml’s C interface enough to have much to say about this topic, and I’m just getting my feet wet in Rust. Rust is definitely the “spiritual offspring” of ML and company (especially OCaml), so there might be some synergy there.
However, my experience in the Python world is that even if you write your native extensions in another language, it’s all going through the C interface anyway, which limits your ability to leverage higher-level abstractions like those in Rust. The other problem is (of course) distribution. If you don’t want to distribute your work, or you don’t mind it only being accessible to people with the Rust compiler, that’s fine, but if your application targets a wider audience, C seems like a more sensible extension language.
Still, might be an interesting personal exercise to try and create some libraries to simplify OCaml and Rust interop—though I have to admit, OCaml is actually the main thing that’s keeping me from learning Rust properly! Every time I think I have a project for Rust, I end up being like, “nah. OCaml is fast enough and I like garbage collection and lists and TCO.”