Skip to content
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

would an "ocamlfind preprocess" subcommand be useful? #4

Open
chetmurthy opened this issue Apr 24, 2020 · 3 comments
Open

would an "ocamlfind preprocess" subcommand be useful? #4

chetmurthy opened this issue Apr 24, 2020 · 3 comments

Comments

@chetmurthy
Copy link
Contributor

It seems like, often there's a use for getting one's hands on the output of the preprocessing step of an "ocamlfind ocamlc ..." command. Both for debugging, but also for interfacing with dune. I can't find a way to do this right now ..... but I'm guessing that I could figure out how to implement it in not much time. Would this be useful? Is there something I'm missing?

Thanks in advance.

@gerdstolpmann
Copy link
Contributor

Yes, that would be useful, but keep in mind that some preprocessors do not output text but the binary AST - which is understood by the compiler but not by a human. So you'd probably also need a pretty-printer for ASTs.

@chetmurthy
Copy link
Contributor Author

I already have a little tool I wrote, a wrapper of Ocaml's compiler-libs, that prints a serialized AST. grin I'll write an addition to ocamlfind, then. I was considering writing a new "ocamlfind2" that would implement new commands, and fallback to the old ocamlfind for everything else, but if you're OK with putting this into ocamlfind, I won't bother.

@chetmurthy
Copy link
Contributor Author

Gerd, a little progress-report. I have written a tool, "ocamlfind2", which implements the "preprocess" function (stealing code from the "ocamlc" entrypoint in frontend.ml), and use it regularly. I'm planning on implementing "reinstall-if-diff" in this little tool soon (busy/busy/busy with PPX rewriters). Two reasons I wrote this status update:
(1) link: https://github.com/chetmurthy/ocamlfind2
(2) I'm -painfully- cognizant of the importance of ocamlfind to the ocaml ecosystem. It would ..... be incredibly embarrassing if some change I submitted, were to break ocamlfind. So .... I would propose that for a good while, we leave these commands in "ocamlfind2", and move them into ocamlfind.
Actually, I don't think you ever commented on "reinstall-if-diff", so I do not mean to go so far as to suggest that you would even be open to moving reinstall-if-diff into ocamlfind, anyway.

Anyway, just thought I should give you a status update, since it's been a while and I've been silent about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants