-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Deriving.find
#513
Add Deriving.find
#513
Conversation
Signed-off-by: Simmo Saan <[email protected]>
Signed-off-by: Simmo Saan <[email protected]>
Thanks for contributing to ppxlib! Could you please give a bit of context? What are you planning to do with this? Is it only the alias use case mentioned in #124 ? If that's the only use case, I'd be more in favor of referring to said deriver directly by linking it. Having this kind of feature is quite error prone as one could totally use it without declaring the dependency over the deriving plugin it's meant to reference, leading to crashing drivers. |
It's the same alias use case, yes. The intention would be that the ppx deriver which uses this feature to define an alias, would declare the other ppx deriver as a (dune) dependency as well. If one forgets that, it will be very obvious because the preprocessor would crash (just like it crashes when multiple derivers for the same name are linked, etc). Of course Lines 148 to 151 in 75c507a
Others (e.g., ppx_deriving_yojson) declare an empty interface. |
I agree that in theory, any cautious dev wouldn't omit this because it wouldn't survive testing but it is still permitted to write such code and have it build without declaring the dependency. Some of the Janestreet derivers seem to expose the declared derivers, we could hint towards doing so for that specific purpose. We can also try and patch the ones you would like to alias. Which one do you intend to use that way? |
I think the ppx_deriving ones an ppx_deriving_yojson. I would be for patching them to expose the derivers. Although I think
It's been a while since I tried this, but if I remember correctly, dune's |
I do expect that you will have to redefine the |
In the meantime I'll also open PRs to expose |
I'm closing this as we decided to instead expose the relevant |
This is a redo of #124 which follows the suggestion from #124 (comment).