In my default switch, I have current stable version of OCaml compiler, version 5.1.1 .
Now when sandboxing my projects with opam switch create, I’d like to reuse that existing installation of compiler, instead of rebuilding it yet again and again for each case. Is there a way to configure opam for such behavior?
Similar like rustup for Rust or ghcup/stack for Haskell, which allow only rebuild per-project dependencies sans the compiler chain itself.
To do so simply (e.g. with hardlinks) would require the relocatable compiler unfortunately, so at the moment you’ll probably need to keep rebuilding compilers unfortunately.
you might depend on different incompatible versions of libs/tools. For example I have some public projects that are using a given version of ocamlformat, and some private projects that are using a different one. Those 2 ocamlformat can’t be installed at the same time.
When creating multiple projects based on various and version constrained dependencies, one does not want to pollute the default switch and those can be easily and safely removed when they are no longer needed. Seriously…