-
Notifications
You must be signed in to change notification settings - Fork 412
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
[coq] Allow Coq libraries to depend on OCaml ones. #1555
Conversation
e3a19c5
to
852a643
Compare
Indeed this seems like a problem. Off the top of my head, coq libraries need 2 main capabilities from this module:
Things like resolving selects, variants, generation of META are all fairly specific to OCaml libraries. We have a couple of options to proceed:
We'll have to ask @diml what he thinks is the best way to proceed. |
"Shoehorning" was my original idea, however I do agree that the current implementation seems cleaner. I am wondering about the I guess this will also depend on how #1206 is implemented. |
Generalising |
3eea0c5
to
5ac6646
Compare
Just a small note from me: consider prefix — |
Sounds good @andreypopp , I will take this into account once the design advances a bit. The next step here, and one that is crucial to have before this can build Coq well is to add support for recursive Coq libraries , in the style of I am not sure what is the best way to do this right now, but given that I don't include Coq modules in With that, and once I fix the "depend on ML libraries" commit [see missing Another source of annoyance is that |
Do you think it would acceptable to not support such constructions? In general, having clever implicit dependencies is a pain. We were talking about this with a few other OCaml developers yesterday and we were saying that we wished OCaml had explicit imports rather than |
We could try to deprecate them step by step, as of today unfortunately |
BTW @ejgallego two small remarks:
|
Thanks a lot @Zimmi48 , indeed sorry if I am maybe not doing the best job on communicating what I am trying to do, most of the time I am learning about things "on the fly", so it is hard to come with a 100% coherent view.
Absolutely; this is a top priority for me; if a newer
I'd say the main question is about what a "Coq library" is. Currently, we have a model where compilation of a module requires the system to know the module name, and that in fact implies resolution over the global scope. This needs reverse lookup, with has some implications. Also, it is not clear what the exact semantics of prefix and module name are, for example are the following prefix/name pairs equivalent < Another topic is indeed static vs dynamic resolution of dependencies. This also has uncovered some bugs as Another point is native compilation, which turns out to be quite complex. |
I would say (to use Dune's terminology) that
This is indeed an important question. I wish the result to be as close as possible to what Dune has done for OCaml so far. It looks very useful to be able to seamlessly use installed or in-tree dependencies. |
I guess that I would say that |
3dcba54
to
4651e7c
Compare
New version pushed, thanks! Comment about how to best locate |
165accc
to
735ee5f
Compare
New version pushed, I think it is starting to shape up, thanks a lot! I tried to improve the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a couple of tweaks. I think this is good enough to merge.
By the way, I'm not sure how much sense it makes to start versioning at 0.1. The fact that breaking changes are expected should deter you from marking this plugin as 1.0. Allowing for graceful breakage is the reason why we have versions in the first place. In the next version of dune you can easily drop support for 1.0 and support 2.0+ only. Or you can maintain support for both 1.0 and 2.0. For example, our initial plugin was also incomplete and almost entirely obsolete. It didn't stop us from making it 1.0 |
Thanks @rgrinberg , I am gonna add a couple of further tweaks related to errors and will merge.
My plan was to keep 0.1 as "no version really" then make it 1.0 once this sees a bit more testing and Coq stdlib itself is built with Dune. So 1.0 would support Coq 8.6-8.1x? and then we'd do a "2.0" that would support Coq 8.1x- ahead, hopefully fixing some annoying problems with How does that sound? IMHO there will be value for supporting 8.8-8.10 for a while. |
Feel free to version things however you want. I just prefer to start counting at 1:) |
Yup, we will turn this into "1.0" the moment I am happy with testing . |
We add a new field `(libraries <ocaml_libraries>)` to the `coqlib` stanza for specifying dependencies on OCaml libs, such as plugins. The current implementation has to workaround a couple of `coqdep` problem: - `-I` flags to `coqdep` must refer to the build tree as to find the `.cmxs` file, this is different from what OCaml needs; - `coqdep` needs to find the `foo.mlpack` file as to emit the correct `cmxs` dependency. However such file won't be available for system-installed plugins. We solve the first one by manually computing the include flags, and the second one by adding a conditional dependency so we don't fail if the file is missing. We should improve `coqdep` so these kind of hacks are not necessary. Signed-off-by: Emilio Jesus Gallego Arias <e+git@x80.org>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit adds experimental Coq support to Dune. See Dune issue #1446
for more details.
The patch adds a new stanza
(coqlib ...)
enabled by adding(using coq 0.1)
todune-project
. The stanza looks like:The functionality of the mode is basic, but it should suffice to
replace and extend most uses of
coq_makefile
.The main remaining issue is the definition of on Coq libraries so we can enable a compositional build.
Local support for Coq libraries should suffice in the short-term. That is to
say,
(coq_libraries ....)
would only see libraries in the samescope, and rely on Coq's default rules for the rest.
However, this doesn't seem straightforward. In particular, we may have
to re-implement
Lib.DB
which is not trivial.Thanks to all for Dune, comments extremely welcome.