-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Description
Even though ppxlib is recommended for implementing new ppx derivers, ppxlib itself doesn't have a bunch of utility functions that are provided by ppx-deriving.api: https://github.com/ocaml-ppx/ppx_deriving/blob/master/src/api/ppx_deriving.cppo.mli.
In particular:
- Quoting. (Add a quoting API inspired by Ppx_deriving #95)
- Mangling (Add mangling utilities from ppx_deriving #370).
- Polymorphism handling.
I would say that most nontrivial ppx derivers need that functionality anyway. Currently there's two options:
- Just depend on ppx-deriving.api in addition to ppxlib. This is done by, e.g., ppx_deriving_yojson. This is not ideal, since the API package doesn't just contain the utilities, but also ppx-deriving's own registration system, which is replaced by ppxlib. Moreover, it prevents deprecation of the API in favor of ppxlib: [WIP] Deprecate the ppx_deriving API in favour of ppxlib ppx_deriving#250.
- Copy the utility functions' implementations to own ppx deriver project. This is done by, e.g., ppx_show. This avoids the dependency but involves copying code, which isn't ideal either. Moreover, fixing or optimizing those utilities is much easier in a central place (Optimize forwarding in eq and ord plugins ppx_deriving#252).
Metadata
Metadata
Assignees
Labels
No labels