OCaml > 4.06.1 and ReasonML Frontend

interop

#1

Hi all,

Working on a project that has an OCaml backend and ReasonML frontend in the same repository that uses merlin to provide code completion. Currently, we’re looking to upgrade the version of OCaml in the backend to version 4.07.0 from 4.06.1 (the same version as Bucklescript) to support some new libraries that we’d like to pull in. After upgrading, both the frontend and backend continue to work.

However, merlin no longer works with the frontend and fails with “stdlib.cmi seems to be compiled with a version of OCaml that is not supported by this merlin” which makes sense given that we only have a single merlin executable compiled with the same version of OCaml as the backend. Any suggestions on how to get around this?

Thanks!


#2

Merlin is highly specific to the version of OCaml it’s compiled with, because the .cmi format changes between versions. The assumption is that one compiler version is used across the entire project. I don’t think there’s a way to make it support multiple compilers. Sorry.


#3

If you make separate opam switches for the frontend and backend (frontend will only need merlin and reason to be installed) that should work. If they are associated with directories you should get the right version of merlin automatically.


#4

That sounds promising! Is it possible to accomplish something similar using esy?