-
Notifications
You must be signed in to change notification settings - Fork 632
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
Replace Pervasives with Stdlib in nat extraction #15333
Conversation
rudynicolop
commented
Dec 11, 2021
•
edited
edited
- Added changelog.
- Opened overlay pull requests.
1e21bcc
to
a64d179
Compare
What are the OCaml versions supported by extraction? Coq itself should build on OCaml 4.05 to 4.13, is it possible to support that range of versions here? |
@rudynicolop: do your #???? in the header intend to refer to #7017 and #13288? As hinted by @proux01, |
Sorry my bad I don't think I need the issue number. |
To allow support for any OCaml version I could inline the functions in the extraction without referring to those in the standard library. I mainly would like to avoid |
Is there a way from inside OCaml to have code dependent on the version of OCaml running? If yes, extraction could add a header redefining An alternative would be to inline the code, e.g. About what you propose, see the discussion at #10936: we would typically need to let |
Now that we have bumped OCaml, we can probably go ahead with this. @rudynicolop Can you rebase on a recent master? cc @ppedrot |
I've taken the liberty to rebase myself for faster integration. |
I've tweaked a bit the commit message because it was the result of squashing temporary commits, but this is ready. Will merge when CI finishes. |
@coqbot merge now |
Extract Inlined Constant max => "Pervasives.max". | ||
Extract Inlined Constant min => "Pervasives.min". | ||
Extract Inlined Constant max => "Stdlib.Int.max". | ||
Extract Inlined Constant min => "Stdlib.Int.min". |
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.
Stdlib.Int.max
was first introduced in ocaml/ocaml#10392.
As a result, the extracted code only compiles on OCaml 4.13.
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.
@liyishuai That's a shame, I saw "since 4.08" at the top of Int
and didn't assume that max and min would not be included. Am I correct in thinking that removing .Int
will be enough?
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.
Yes removing .Int
should fix the issue.
Maybe also worth adding https://github.com/liyishuai/coq-http (that revealed this issue) to the CI test suite.