Description
After a healthy discussion of all the different ways OCaml can work on Windows on discuss.ocaml.org there seemed to be at least some consensus that the current information needs updated (disclaimer: I'm not a windows user, I just want to see this issue resolved). To that end, I've tried to summarise the different points made with some pros and cons and hopefully someone with a little more Windows experience can take this issue and make a PR (or perhaps we can reach a consensus here on the issue), there's a vague proposal at the end.
Current Situation
The site currently uses the up_and_running
post to detail how to get OCaml on a variety of OSes. On windows it recommends OCaml for windows. The problem highlighted on discuss is that the underlying opam-repository (opam-repository-mingw
) is to be discontinued next month: https://fdopen.github.io/opam-repository-mingw/2021/02/26/repo-discontinued/
Possible updates
WSL2
Pros: seems to be easy to setup and should work with most OCaml because it is Linux, this is in fact what we recommend in the CONTRIBUTING.md for this site. This is important to note, if a new user simply wishes to "run OCaml on their windows machine" perhaps this is the simplest and most robust approach?
Cons: as pointed out on discuss you need a complicated cross-compiling environment in order to get windows binaries.
OCaml for Windows + Explanation of overlays
Pros: sticking almost with the current content but providing more information about how to use the various existing opam-repositories @dra27 describes in this comment. This is truly OCaml on windows though.
Cons: requires a greater understanding of OCaml tools like opam and so the explanation will be longer and likely more confusing for complete beginners.
Docker
Pros: Thanks to some awesome work there are now OCaml windows docker images, this would remove a lot of head-scratching setup for beginners. The images are also being used in CI so should be updated regularly and in a working state.
Cons: dependency on docker
Aside: it may be worth mentioning the docker images (https://hub.docker.com/r/ocaml/opam) anyway, I think a lot of beginners will have docker installed these days especially coming from any other programming languages and in the initial "trying out OCaml" phase this might be a very painless way to get started?
Proposal
Again, disclaimer, I am not a windows user but it feels like perhaps mentioning all of these approaches could be useful in a staged way of saying:
- Run OCaml on Windows => WSL2
- Run OCaml and produce Windows binaries => OCaml on Windows, plus explanation of opam-repository, deprecation of opam-repository-mingw and something about opam.2.2.0 plans. Perhaps if this starts getting too long we can split it into its own page, someone has to explain OCaml on windows somewhere, why not ocaml.org :)) ?
And perhaps a section on the docker images which would be useful for Linux, macOS and Windows users to get "up and running" with OCaml.