OCaml Platform Newsletter: August 2023

Welcome to the fifth edition of the OCaml Platform newsletter!

Dive into the latest updates from August and discover how the OCaml Platform is evolving. Just like our previous newsletters, we’ll spotlight the recent developments and enhancements to the OCaml development workflows.

In August, we unveiled the initial draft of the OCaml Platform roadmap, following the recently adopted Guiding Principles and User Personas. The thread has seen a lot of activity, and we’re thrilled to see so much engagement to discuss the direction of OCaml developer tooling. A warm thank you for actively joining the conversation and sharing your feedback! This has prompted numerous discussions with the Platform maintainers, and we’re considering all your feedback as we’re working on revisions to the roadmap.

Another headline from August was initiating the integration of wasm_of_ocaml into Dune in order to compile OCaml programs to WebAssembly (Wasm). This follows the recent announcement of the ocaml-wasm organisation. This is an exciting time! Compiling OCaml programs to WebAssembly is becoming a reality!

But more on that below. Let’s delve into all the progress that happened last month.


Here are all the new versions of Platform tools that were released this month:

For detailed release notes and announcements, explore the OCaml Changelog.

Building Packages

[Dune] Exploring Package Management in Dune

Contributors: @rgrinberg (Tarides), @Leonidas-from-XIV (Tarides), @gridbugs (Tarides), @kit-ty-kate (Tarides), @Alizter

This month saw good progress on supporting lock directory generation for more opam packages by adding support for various opam features. Notably, the team implemented a new when action to support opam’s conditional build steps and the accompanying PR to convert opam filters to when actions.

Work also started on initialising Dune’s context from the lock file. This is the last missing piece that ties all the implemented features together (source fetching, opam-repository management, lock directory generation, etc.). This makes it possible to run dune build to build a project that has opam dependencies.

The work on the above – extending coverage of opam packages when generating the lock directory and initialisation of Dune’s context from the lock directory – should continue next month. The team also started tracking missing features in Dune’s backlog more thoroughly. You can have a look at the list of issues on GitHub.


[opam] Native Support for Windows in opam 2.2

Contributors: @rjbou (OCamlPro), @kit-ty-kate (Tarides), @dra27 (Tarides), @AltGr (OCamlPro)

Following the release of the second alpha of opam 2.2 last month, the opam team started working on the third alpha and merged numerous bug fixes and improvements.

They also started working on generating static binaries for Windows.

The next step, in anticipation to the first beta release of opam 2.2, is to make the opam-repository compatible with Windows by upstreaming patches from ocaml-opam/opam-repository-mingw and dra27/opam-repository.

The work on this will continue next month, but in the meantime, don’t hesitate to install opam 2.2~alpha2 and report any issue you have!

[Dune] Compile to WebAssembly with wasm_of_ocaml

Contributors: @vouillon (Tarides), @hhugo

Following the recent announcement of the ocaml-wasm organisation, the wasm_of_ocaml team landed a PR on Dune that brings support for compiling OCaml programs to WebAssembly (Wasm)!

The target user experience will be similar to the JavaScript compilation on Dune; that is, you’ll be able to add wasm as a mode to Dune executables:

(executable (name foo) (modes wasm))

And running dune build will produce a Wasm binary.

The PR is in the early stage and is in active review, but given the impressive progress of the wasm_of_ocaml team on the runtime implementation, do stay tuned for more updates on this in the coming weeks and months.


[Dune] dune monitor: Connect to a Running Dune build

Contributors: @Alizter

In July, @Alizter started work on a new dune monitor command to connect to a running Dune build.

This work continued this month, and as part it, lots of improvements were made to Dune RPC, including reports of failed jobs and better error messages.

The PR has been merged and the new command will be available in the upcoming Dune 3.11, scheduled for September.


[Dune] Dune Terminal User Interface

Contributors: @Alizter, @rgrinberg (Tarides)

Back in April, Dune introduced a new tui display mode, contributed by @Alizter, which was a meant as a foundation to bring a GUI-like experience to Dune.

The saga continued in August, and @Alizter ported the TUI to Nottui, a terminal-based user interface library, to add more interactivity to the tui mode. In particular, the error messages are now scrollable, and they can be expanded/minimised.

These features will be available in the upcoming Dune 3.11. Do try the new TUI and let the Dune team know if you have any feedback!


Generating Documentation

[odoc] Add Search Capabilities to odoc

Contributors: @panglesd (Tarides), @EmileTrotignon (Tarides), @julow (Tarides), @jonludlam (Tarides)

After fixing some of the issues identified last month, the odoc team started actively reviewing the Pull Request to add a search bar to odoc’s HTML output.

As a result of the reviews, a few related issues were identified and have been addressed as a prerequisite to move forward on the search feature. Notably, improvements were needed on the stability of link to source code by implementing semantic anchors.

Next month, the odoc team plans to continue reviewing the different Pull Requests, with the aim to cut a major release of odoc with support for search the following weeks.


[odoc] Syntax for Images and Assets in odoc

Contributors: @panglesd (Tarides)

Following the discussion started in July, the odoc team started the implementation work to add support for images and assets in odoc.

Work is ongoing to implement a syntax to reference arbitrary assets, as a requirement to both the search feature and the support for images.

We’re getting closer and closer to having images on OCaml.org’s centralised package documentation!

Editing and Refactoring Code

[Merlin] Support for Project-Wide References in Merlin

Contributors: @voodoos (Tarides), @trefis (Tarides), @Ekdohibs (OcamlPro)

As announced last month, the focus in August was on upstreaming the necessary changes to the compiler. A PR on the compiler was opened and is currently under active review. The Merlin team is hopeful that it will be merged in time for the next release of OCaml 5.2.

The team is also considering backporting the patches on previous versions of the compiler and making them available on opam. This would allow people to start testing the feature early, without having to wait for the release of OCaml 5.2.