Open NathanReb opened 4 months ago
Actually, the interesting thing (which is maybe why the two could coexist some projects so far?) is that they use disjoint argument patterns:
ptyp
argument, e.g. [%map: ...]
.single_expr_payload
argument, e.g. let%map ...
which is [%map let ...]
.I guess ppxlib cannot resolve the conflict based on the patterns, but conceptually it sounds possible. Although having ppx_let declare itself with a prefix would only be good.
I don't think that's why they could cohabit before. map
used to be declared via ppx_deriving
's api which registered to ppxlib as a whole file transform and not a context free rule, ppxlib was not in charge of interpreting ppx_deriving.map
's extension and knew nothing about it.
Regardless of what is done on ppx_deriving's side, it's good practice to allow prefixed extension names.
We recently tried to release a new version of
ppx_deriving
where the set of standard derivers it includes were ported to ppxlib's deriving API instead of the deprecated ppx_deriving one.Doing so uncovered a clash in extension names between
ppx_deriving.map
andppx_let
.Each ppx_deriving standard derivers comes with an expression extension which can be used to derive the relevant inline function for a given
core_type
. E.g. withppx_deriving.show
you can write:Those extensions are declared as
derive.<deriver_name>
, allowing other ppx-es to declare other such extensions as well and be used alongsideppx_deriving
's standard derivers.ppx_let
defines a[%map ...]
extension without any prefix making it impossible for any other ppx to declare an extension namedmap
with or without prefixes as it is then impossible to disambiguate theppx_let
's extension.I believe declaring all
ppx_let
extensions asppx_let.<extension_name>
would fix this issue while being a seemless change to users.Does this sound like an acceptable change to you? I'm happy to submit a PR if so.