# Oxidizing OCaml, and a new opam switch

**URL:** <https://discuss.ocaml.org/t/oxidizing-ocaml-and-a-new-opam-switch/12942>\
**Category:** Ecosystem\
**Tags:** type-system, ocaml\
**Created:** [September 1, 2023, 6:15pm UTC](https://discuss.ocaml.org/t/oxidizing-ocaml-and-a-new-opam-switch/12942 "2023-09-01T18:15:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaron\_Minsky](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yaron_minsky/32/11_2.png) [@Yaron\_Minsky](https://discuss.ocaml.org/u/Yaron_Minsky)\
**Post date:** [September 1, 2023, 6:15pm UTC](https://discuss.ocaml.org/t/oxidizing-ocaml-and-a-new-opam-switch/12942/1 "2023-09-01T18:15:16Z")

</div>

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.

Here are the posts:

- [Locality](https://blog.janestreet.com/oxidizing-ocaml-locality/)
- [Rust Style Ownership](https://blog.janestreet.com/oxidizing-ocaml-ownership/)
- [Data Race Freedom](https://blog.janestreet.com/oxidizing-ocaml-parallelism/)

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](https://github.com/janestreet/opam-repository/tree/with-extensions).

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.

y

---

<div class="post-metadata">

**Author:** ![cdaringe](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/cdaringe/32/2419_2.png) [@cdaringe](https://discuss.ocaml.org/u/cdaringe)\
**Post date:** [September 6, 2023, 3:15am UTC](https://discuss.ocaml.org/t/oxidizing-ocaml-and-a-new-opam-switch/12942/2 "2023-09-06T03:15:40Z")

</div>

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? 😀 🙏

---

<div class="post-metadata">

**Author:** ![UnixJunkie](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/unixjunkie/32/638_2.png) [@UnixJunkie](https://discuss.ocaml.org/u/UnixJunkie)\
**Post date:** [September 7, 2023, 12:52am UTC](https://discuss.ocaml.org/t/oxidizing-ocaml-and-a-new-opam-switch/12942/3 "2023-09-07T00:52:21Z")

</div>

Can’t the “local” annotations be automatically inserted by some static analysis?  
That would be cool.

---

<div class="post-metadata">

**Author:** ![otini](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/otini/32/3533_2.png) [@otini](https://discuss.ocaml.org/u/otini)\
**Post date:** [January 18, 2024, 2:44pm UTC](https://discuss.ocaml.org/t/oxidizing-ocaml-and-a-new-opam-switch/12942/4 "2024-01-18T14:44:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kakadu](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/kakadu/32/1204_2.png) [@Kakadu](https://discuss.ocaml.org/u/Kakadu)\
**Post date:** [March 24, 2024, 8:45am UTC](https://discuss.ocaml.org/t/oxidizing-ocaml-and-a-new-opam-switch/12942/5 "2024-03-24T08:45:30Z")

</div>

I installed new OCaml using README but I can’t test examples with `unique` extension. Where could

> ```plaintext
> ✗ ocamlc -extension unique                                                              
> ocamlc: wrong argument 'unique'; option '-extension' expects one of: comprehensions local include_functor polymorphic_parameters immutable_arrays module_strengthening layouts layouts_beta layouts_alpha simd.
> Usage: ocamlc <options> <files>
> Try 'ocamlc --help' for more information.
> ✗ ocaml                                                                                                                                    
> OCaml version 4.14.1+jst
> Enter #help;; for help.
> 
> # let dup x = unique_ (x, x);;
> Error: Unbound value unique_
> 
> ```

But this stuff seems to work somehow

> <https://github.com/ocaml-flambda/flambda-backend/blob/main/ocaml/testsuite/tests/typing-unique/unique.ml>
