realworldocaml / book

V2 of Real World OCaml
https://dev.realworldocaml.org
Other
1.19k stars 174 forks source link

Windows: Testing and support #3657

Open jonahbeckford opened 1 year ago

jonahbeckford commented 1 year ago

I received an issue a while back (https://github.com/diskuv/dkml-installer-ocaml/issues/11) to support base in utop for the Diskuv OCaml distribution (Windows, MSVC). I've also seen the same thread pop up in discuss.ocaml.org ... I presume people are reading Real World OCaml, but it didn't work so well on Windows.

Things have changed with the v0.15.x releases.

To simplify reading Real World OCaml I am automatically installing base in the Diskuv OCaml installer so that it is accessible from utop. I will also be installing a shim for utop so that the stublibs for base are accessible. That means, immediately after installation, a Windows user will be able to open utop in the Command Prompt or Power Shell, then do a #require "base";;, and they'll be able to follow along with the base portions of Real World OCaml.

That won't help them with core; that is too costly to install for every user, and more importantly I don't think it wise for a Windows user today to get too used to Jane Street libraries beyond base. async, among other things, does not have a Windows implementation. But they can always create a switch (dkml init ; opam install utop core) if they need core.

Key questions:

  1. Will there be a next release of the book?
  2. (Doubtful, but I'll ask anyway) Do you see future support for Windows in more of the Jane Street libraries. async is one example of a critical Jane Street library that isn't supported on Windows. But perhaps there will be an OCaml 5 eio backend for async that will work on Windows.
  3. I assume there is some CI that is running RWO. Does it have Windows? That will make it clear which parts of the book work on Windows, and which don't. I do maintain https://github.com/diskuv/dkml-workflows#dkml-workflows which can be used to test Windows + MSVC for the more native Windows users.

Thanks!

avsm commented 1 year ago

Nice work all around!

1) There will, but the online is updated immediately and more regularly, so this benefits users without waiting. 2) I'll leave @yminsky to answer about Async, but I can confirm that we will have a good eio Windows backend (based on IOCP) and that there does exist an eio-async bridge. 3) GitHub Actions and ocaml-ci. The former does have Windows, and the latter -- I'll need to ask @dra27

dra27 commented 1 year ago

ocaml-ci doesn't yet, but it should start to fall into place when the opam 2.2 alpha comes out later this/next month. There're still some problems we're having with the Windows Docker-based obuilder backend, but I don't have the details.

yminsky commented 1 year ago

Thanks from me too for this! Exciting stuff.

FWIW, the build-expense cost of installing Core seems like a reasonable reason to avoid it, but I don't think the lack of a Windows port of Async is, really. Core doesn't really tie you to Async any more than Base does.

I'd love to see a Windows backend for Async, but it's not something we've had much internal need to work on. That said, we'd be excited to help and advise anyone who wanted to push in this direction. I think architecturally there's not much preventing the creation of such a back-end. We already have Async working with Javascript, which is at least as foreign of an environment as Windows!