-
Notifications
You must be signed in to change notification settings - Fork 426
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
Make the ppx's driver aware #2079
base: master
Are you sure you want to change the base?
Conversation
The current ppx's only act as classical ppx's which make them unusable for all dune users. The situation is easily fixed by defining the rewriters using dune's ppx_rewriter kind. This will create a ppx library that will work when linked into a driver and a standalone ppx.exe rewriter for use in classical ppx. findlib's tags are used to distinguish the 2 cases (see the ppx_driver tag). The only "problem" with this transition is that every ppx needs a valid library name. We could maintain the old names, but then we'd have to introduce toplevel packages for them. Instead, we just put these ppx rewriters under the reason pacakge. Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Btw, this will of course also make all the .merlin hacks unnecessary. dune will know to generate the correct .merlin after this change. |
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Btw, I suppose I can also get 100% compatibility with master by defining the old exe's as manual drivers. Quite ugly, but possibly worth it. @jordwalke what do you think? |
Why is it ugly to make the old exe's manual drivers? |
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
I added a commit as an example of how to do it for ppx_react. The rest are done similarly. I guess it's not so ugly, just completely pointless. Those who insist on using classical ppx can turn the rewriter with |
Hey! Thanks, but we were actually planning to fuse the ppx and refmt (optionally expose it as a flag of |
We might still benefit from making these ppx processors compatible with ppx drivers, even when we fuse the ppx into Fusing the ppx into
Number one doesn't benefit everyone, but it's still a nice feature to have for those who do just install a global binary. Number two is more interesting. |
@rgrinberg note that |
It's not a problem in the sense that it is easily solved by making the standalone shim binaries like I did for ppx_react. I could do it for the rest of the binaries as well. Also, let's not forget the benefit of making these rewriters available for normal OCaml users who still like the traditional syntax. Finally, you should consider the value that ppxlib provides in the long term when it's ready. It would make defining simple ppx's such as this far more trivial. Would be nice to keep this option if you don't plan to take it for now. |
The current ppx's only act as classical ppx's which make them unusable for all
dune users. The situation is easily fixed by defining the rewriters using dune's
ppx_rewriter kind.
This will create a ppx library that will work when linked into a driver and a
standalone ppx.exe rewriter for use in classical ppx. findlib's tags are used to
distinguish the 2 cases (see the ppx_driver tag).
The only "problem" with this transition is that every ppx needs a valid library
name. We could maintain the old names, but then we'd have to introduce toplevel
packages for them. Instead, we just put these ppx rewriters under the reason
pacakge.
Signed-off-by: Rudi Grinberg rudi.grinberg@gmail.com