The documentation states the following about [@@deriving_inline]:
|
You might notice that the resulting file when using |
|
``[@@deriving_inline]`` needs no special treatment to be compiled. In |
|
particular, you can build it without the ppx rewriter or even |
|
ppxlib. You only need them while developing the project, in order to |
|
automatically produce the generated code but that's it. End users of |
|
your project do not need to install ppxlib and other ppx rewriters |
|
themselves. |
However, this appears not to be true, as I observed by doing the following:
- Added
[@@deriving_inline yaml][@@@end] after a type declaration.
- Added
(lint (pps ppx_deriving_yaml)) into the dune file.
- Ran
dune build @lint --auto-promote, which did promote the inline implementations.
- Ran
dune build, which fails with the following:
10 | [@@deriving_inline yaml]
^^^^
Error: Ppxlib.Deriving: 'yaml' is not a supported type deriving generator
It appears to me that ppxlib is still trying to run the deriver for [@@deriving_inline] when there's already an implementation present (which I guess makes sense for round-trip checking, #338), but does so even when that deriver was only active for linting and not the normal build.
This defeats the claim of being able to drop dependencies for ppx-s, since for the normal build to succeed, I still need that deriver also in dune's (preprocess (pps ...)).
Or maybe I'm trying to use [@@deriving_inline] in an unusual way: to drop some deriver dependencies, but not all (so still have others present). The motivation for doing that is to use an unreleased version of the deriver (using opam pin) in a package that is to be released on opam (where it cannot have pins) without being forced to wait for the ppx's release.
The documentation states the following about
[@@deriving_inline]:ppxlib/doc/ppx-for-end-users.rst
Lines 77 to 83 in 9360b0c
However, this appears not to be true, as I observed by doing the following:
[@@deriving_inline yaml][@@@end]after a type declaration.(lint (pps ppx_deriving_yaml))into the dune file.dune build @lint --auto-promote, which did promote the inline implementations.dune build, which fails with the following:It appears to me that ppxlib is still trying to run the deriver for
[@@deriving_inline]when there's already an implementation present (which I guess makes sense for round-trip checking, #338), but does so even when that deriver was only active for linting and not the normal build.This defeats the claim of being able to drop dependencies for ppx-s, since for the normal build to succeed, I still need that deriver also in dune's
(preprocess (pps ...)).Or maybe I'm trying to use
[@@deriving_inline]in an unusual way: to drop some deriver dependencies, but not all (so still have others present). The motivation for doing that is to use an unreleased version of the deriver (using opam pin) in a package that is to be released on opam (where it cannot have pins) without being forced to wait for the ppx's release.