Dear all,
We are preparing a 2.0.0 release of ocaml-migrate-parsetree. This new major release will simplify the project to its core purpose, which is to provide migration functions between the various versions of the parsetree types. Everything else, such as the driver or the per-version copy of various modules from the compiler distribution will go away. This will have an impact for projects that are currently using these functionalities and this post describes what we think such projects should do and how we plan to help.
The motivation for this change is to simplify ocaml-migrate-parsetree and make it easier to maintain. The core functionality it provides is valuable and worth maintaining, however right now the project is way too big and difficult to maintain. Going through compiler upgrades has been unpleasant and difficult. And because of this, bugs of the segfault kind have accidentally been introduced and detected much later.
Once we have dropped everything that doesn’t fit in the purpose of the project, what will remain will be pretty simple, coherent and easy to maintain.
What is the replacement?
At the moment, ocaml-migrate-parsetree offers one way of writing ppx rewriters. For instance, one might write the following to create a ppx rewriter with ocaml-migrate-parsetree:
open Migrate_parsetree
open Ast_404
let structure = ...
let signature = ...
let () =
Driver.register ~name:"ppx_cstruct" Versions.ocaml_404
(fun _config _cookies -> {default_mapper with structure; signature})
Following the simplification, the above code will break for at least two reasons:
- the
Migrate_parsetree.Driver
will be gone - the
default_mapper
andmapper
type coming from
Ast_404.Ast_mapper
will be gone
As a result, ocaml-migrate-parsetree itself will no longer be enough to write ppx rewriters.
We recommend that ppx rewriters using the ocaml-migrate-parsetree API switch to ppxlib. The purpose of ppxlib is to provide a good API for ppx rewriters with in particular a simple and good composition model, so it seems like a natural choice. Since ppxlib will take a more central place in the ecosystem, we are currently addressing the more controversial aspects of this library. For instance, we are dropping the dependency on Base.
Organising the transition
The following ticket is the meta issue tracking the preparation of the 2.0.0 release:
To make this transition smoother, we are planning to help with the porting effort. We have prepared a list of ppx rewriters to port to ppxlib. This list is not exhaustive and in particular excludes ppx rewriters that have no reverse dependencies in opam in order to keep this work manageable for us. In any case, help porting projects to ppxlib would be very much appreciated.
If you would like to help porting a project, please mention on the corresponding ticket from the list that you are looking at porting this project so that we know someone is working on it. If you would like to port a project that is not on this list, you should feel free to open a new ticket and mention that you are porting this project. In this case, please make sure to add the label port-to-ppxlib
to the issue.
Once we have successfully converted a few projects, we will proceed with the release of ocaml-migrate-parsetree 2.0.0 and a compatible ppxlib release. At this point, most existing reverse dependencies of ocaml-migrate-parsetree will be marked as incompatible with ocaml-migrate-parsetree 2.0.0 and we will continue porting existing projects to ppxlib to gradually make the world compatible with ocaml-migrate-parsetree 2.0.0.
Consequences for other ppx libraries
ppx_deriving
The master of ppx_deriving is now using ppxlib, so there shouldn’t be much to do to make ppx_deriving compatible with ocaml-migrate-parsetree 2.0.0.
ppx_tools_versioned
ppx_tools_versioned will no longer have a reason to exist in this new state of the world and so will stop being updated.