I’d like to clarify a couple of things about ppxlib and the PPX ecosystem and how it influences building software with OCaml.
The initial statement of this thread was that it’s generally “hard to build Ocaml software”. The example you gave to support that statement, @koala, was a PPX incompatibility. That example was very good to read about since it shows us the limits of our compatible PPX ecosystem efforts! However, I don’t think it’s a good example to support the thesis that it’s generally “hard to build Ocaml software”: as @dbuenzli has pointed out, the opam-repository ecosystem provides a great experience, including PPXs! And as @davisnx has pointed out, the problematic PPX of your example isn’t on the opam-repository.
About the question whether the PPX in question, jsoo-react.ppx, did something “wrong”: “wrong” is a strong word, but I think there are things that both we, the ppxlib
maintainers (possibly in collaboration with other ecosystem tool maintainers) and the maintainers of jsoo-react.ppx could do/have done better. For the latter: when writing a PPX that’s not released on opam, I strongly recommend adding an upper bound on the ppxlib
version (that’s not necessary or recommended for PPXs released on opam).
Some of the comments have been about the question of what has been improved over the years in the PPX world to provide good compatibility. The answer is: lot’s of things
. Let me focus on the three things that are the most relevant in this context. One is opam and the opam-repository themselves: as mentioned, thanks to the opam-repo maintainers, the opam PPX ecosystem is always consistent. The next one is related, but an effort on the ppxlib
side: whenever we cut a release that adapts to compiler changes which break PPXs, we create a big work-space with close to all opam PPXs and patch the ones we break. That makes sure that the opam PPX ecosystem is not only consistent, but also up-to-date and compatible. And the third one is the one @panglesd has mentioned in his answer above: since ppxlib.0.26.0
, we’ve considerably improved our way to adapt to compiler changes. To give an example: the 4.14
compiler release introcued quite a fundamental parsetree change. For those familiar with the parsetree: Ppat_construct
was modified. Without the improvement we did, we would have broken over 30 PPXs. With the improvement, we broke “only” 9 (and, of course, patched them). Side-note: notice that modifications in the parsetree on nodes like Ppat_construct
aren’t very common, so these high numbers aren’t usual.
About a couple of other comments:
trying to get all ppx-es used in a project to agree on a non-empty intersection for ppxlib version bounds and such can be challenging"
This should not be the case. If you have a recent example of this being challenging, it would be very interesting to hear about it!
the real problem with PPX is that it lacks quasi-quotations
For a -limited but very helpful- quotation and anti-quotation system, you have metaquot
. Possibly, one of the things you’re saying is that it would be nice if metaquot
was a bit more powerful. I agree with that. However, as @panglesd has pointed out, metaquot
isn’t the only way to write a stable PPX: since ppxlib.0.26.0
, the Ast_builder
and Ast_pattern
modules also provide a stable sub-API.