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
Fixes #18434: arguments of --external in coqdoc were inadvertently swapped #18448
Fixes #18434: arguments of --external in coqdoc were inadvertently swapped #18448
Conversation
tools/coqdoc/cmdArgs.ml
Outdated
if Array.length Sys.argv < !Arg.current + 3 || | ||
Sys.argv.(!Arg.current + 2).[0] = '-' then | ||
raise (Arg.Bad ("Two arguments expected: <url> and <path>")) | ||
else | ||
Arg.current := !Arg.current + 1; | ||
f s Sys.argv.(!Arg.current + 1)) | ||
f Sys.argv.(!Arg.current + 1) url) |
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.
While the fix is fine, I think the resulting code will be very confusing for anyone that reads it later on, since it surreptitiously swaps the arguments. Rather than modifying the function above, it might better to just replace its call arg_url_path Index.add_external_library
below by arg_url_path (fun url lp -> Index.add_external_library lp url)
.
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.
To have to twist less our minds, we could also swap the arguments in Index.add_external_library
?
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.
You could also use labels, they're a great way to disambiguate arguments with the same type.
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.
To have to twist less our minds, we could also swap the arguments in
Index.add_external_library
?
I did consider it, but since it involves changing the API, I refrained from suggesting it. (And I consider the API to be fine here, since having the logical path as the first argument is the sensible choice, in my opinion. As a user, I did mess a few times the order of the arguments of --external
becomes it is not natural to me.) That said, I would not oppose it, since I doubt anyone other than Coq itself is using that API.
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.
OK, then, to preserve the API, I adopted arg_url_path (fun url lp -> Index.add_external_library lp url)
.
4068017
to
efd6634
Compare
@coqbot run full ci |
@coqbot merge now @SkySkimmer mention, just in case it goes under the radar for 8.19.0 |
(cherry picked from commit efd6634)
…qdoc were inadvertently swapped
Backport seems done, however the 8.19.0 project page was not updated, added this PR to the "request" list so it can be properly processed. |
Fixes / closes #18434
Should go to 8.18.1 (if any) or 8.19.0