-
Notifications
You must be signed in to change notification settings - Fork 98
The State of the PPX Transition
The issues we were facing and are tackling with our current plan are the following:
- To keep the PPX ecosystem cross-compiler compatible
a)
ppxlib
was handling and abstracting away parts of the unstablecompiler-libs
API; b)OMP
/ppxlib
was keeping the AST migration information up-to-date. That situation required us and the compiler developers to coordinate for each compiler release in order to guarantee that the new compiler could be used in projects with PPXs. - To guarantee new feature support,
ppxlib
needs to bump theppxlib
AST to the newest version, which implies a breaking change. That was an issue for a homogeneous and up-to-date PPX ecosystem. - Not all PPXs had migrated from
OMP
toppxlib
. That was also an issue for a homogeneous and up-to-date PPX ecosystem.
The first part works towards continuous cross-compiler compatibility (Issue 1. above) while making the situation of still having PPXs based on OMP
(Issue 3. above) even more of a problem. It consists of implementing an interface module called Astlib
between ppxlib
and the compiler, then upstreaming it to the compiler. Here are its six steps:
- Moving the
OMP
driver and otherOMP
features fromOMP
toppxlib
. That was done in August 2020, and it introducedOMP2
. This was the start of having the PPX ecosystem split into the two incompatible worlds ofOMP1
PPXs on one hand andppxlib
PPXs on the other hand. - Reducing the
compiler-libs
usage inppxlib
as much as possible to keepAstlib
minimal. That has been completed over time. - Implementing a
ppxlib
internal version ofAstlib
as a layer betweenppxlib
and the compiler. This is currently (July 2021) the state on our main branch, but it hasn't been released yet. - Working on an upstream version of
Astlib
for the compiler and adapting the tooling to update the AST migration logic to the compiler. That's next on our ToDo list. - Discussing the upstream version and the workflow to update the AST migrations with the compiler developers, with the aim to upstream it.
- Simultaneously to upstreaming
Astlib
, implementing the logic to use our internalAstlib
on old compilers and the upstreamAstlib
on new compilers intoppxlib
.
Moving the driver from OMP
to ppxlib
(Step 1. above) made the fact that some PPXs were still based on OMP
(Issue 3. above) even more of a problem since it split the PPX world in two. For some PPX developers, the reason to avoid porting their PPXs to ppxlib
was that ppxlib
depended on base
and stdio
, so we decided to tackle this situation by three means:
- Dropping the
base
and thestdio
dependencies, which was done in August 2020. - Porting and reviewing some of the most important PPXs ourselves. So far we've ported
js_of_ocaml
,bisect_ppx
, andtyxml
with the help of the respective maintainers, and we've also reviewed several ports. - Spreading the word about the need to port PPXs and asking for help. A lot of people have joined the effort!
In summer 2020, we made a non-exhaustive list of PPXs that needed to be ported. By now (in July 2021), all PPXs on that list have been ported with the only exception of ppx_import
, which has a port, but it's not quite ready to be merged.
You can find the full list of opam packages that are still stuck in the OMP1
world by filtering for them in opam's health check pipeline. However, notice that is a generated list, so it also contains libraries that intrinsically form part of the OMP1
ecosystem (such as ppx_tools_versioned
), PPXs that have already been ported but haven't relesed their port on opam yet, deprecated PPXs that aren't marked as deprecated, and PPXs that only transitively depend on OMP1
.
Our current plan doesn't provide a solution for the problem that a few PPXs break whenever we bump the ppxlib
AST (Issue 2. above), but it does make handling the problem more efficient and takes away the burden from the PPX developers. Since the AST bump to 4.10
, whenever we bump the AST, we create a workspace with all PPXs fulfilling a certain standard, fix the PPXs that break all at once, and open patch PRs. We call that workspace the ppx-universe
. You can find a ppx-universe snapshot on our repo.
Our plan is to make the tooling that creates and interacts with the workspace more sophisticated. We use opam-monorepo as main tool. For the rest, we are currently using a ppxlib-specific bash script.