We just posted the thrilling conclusion to our blog trilogy on Oxidizing OCaml, which talks about some of the things we’ve been working on (and some of our space-age plans) around extending OCaml to support some of the same kinds of things that Rust lets you do, but in a distinctly OCaml-ish way.
Maybe more excitingly, you can play around with the version of our internal compiler that has the bits of this we’ve implemented thus far (mostly, the local/global stuff, but the beginnings of uniqueness as well) as well as our open-source libraries, via an opam switch.
This is very much a bleeding-edge, unstable version. We use it internally for real work, but we refactor it mercilessly, and the language features are most definitely not stable. We hope one day to propose a lot of this upstream, but for now, it’s just a preview of some interesting experiments.
The thing I’m most excited about all of this is the prospect of data-race free OCaml. The ability to leverage the great work done by the Multicore team, but safely, is a prospect I’m very much looking forward to.
Also, a bunch of Jane Street compiler folk will be at ICFP next week. If you’re interested in learning more, that’s a good time to grab one of us.
Super cool! As a part time rustacean, much of it resonated. It’s a big divergence from status quo ocaml, no doubt. The new concepts really do seem to map nicely with the rust concepts, albeit rebranded. Shall I be looking forward to a Signals n Threads ep soon?
This was a great read. Is there visibility on the chances of integration upstream, particularly of locality modes?
Data race freedom is exciting as well. Reading it, however, I wondered how intentional data races fit into this scheme. In OCaml, it is legal to race on a non-atomic value; and it can make sense to do it when you don’t care about having a total ordering between reads and writes. Efficient implementations of parallel-safe data structures sometimes involve intentional races, the same way relaxed atomics are often used in C.