Skip to content

Restore -vmthreads flag as an error#2312

Merged
xavierleroy merged 6 commits intoocaml:trunkfrom
dra27:restore-vmthreads-cli
Mar 13, 2019
Merged

Restore -vmthreads flag as an error#2312
xavierleroy merged 6 commits intoocaml:trunkfrom
dra27:restore-vmthreads-cli

Conversation

@dra27
Copy link
Copy Markdown
Member

@dra27 dra27 commented Mar 12, 2019

I'm sorry, I didn't look at #2289 in time to comment there. Apropos #2276 (comment), however unused it may be, I don't think that a CLI flag should simply disappear.

This GPR restores -vmthread with an adapted version of the deprecation message as an error message and also keeps the use_vmthreads part of ppx contexts.

I realise how pointless this looks, but experience of firefighting breakage around removing/renaming flags and things in the opam, opam-depext and various other parts of that "which no one uses" has left me highly suspicious of removing flags or variables ever!

@avsm
Copy link
Copy Markdown
Member

avsm commented Mar 12, 2019

I totally agree; this will make finding older uses of vmthreads much much easier!

@ghost
Copy link
Copy Markdown

ghost commented Mar 12, 2019

That seems fine to me if it helps package maintainers. When do you plan to remove these completely?

@dra27
Copy link
Copy Markdown
Member Author

dra27 commented Mar 12, 2019

@diml - never, well, or perhaps when the driver is completely overhauled. I can't conceive how this particular one would ever come back into being, but in the case of -plugin in 2276, it also serves as a permanent code marker that "this flag meant something once, consider that if you're about to re-use it".

Copy link
Copy Markdown
Contributor

@xavierleroy xavierleroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent is good but I don't understand the way it is implemented, see below. Can you explain?

driver/main.ml Outdated
let _strict_formats = set strict_formats
let _no_strict_formats = unset strict_formats
let _thread = set use_threads
let _vmthread = set use_vmthreads
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not failing immediately when reading the -vmthread argument?

utils/clflags.ml Outdated
let annotations = ref false (* -annot *)
let binary_annotations = ref false (* -annot *)
and use_threads = ref false (* -thread *)
and use_vmthreads = ref false (* -vmthread *)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really like to get rid of this use_vmthreads reference.

@shindere
Copy link
Copy Markdown
Contributor

shindere commented Mar 12, 2019 via email

@dra27
Copy link
Copy Markdown
Member Author

dra27 commented Mar 12, 2019

@xavierleroy - the "implementation" is to revert the change from #2289, so the reference is simply that which was in Clflags before. That's no particular defence, except that there's basically no new code relative to the pre-#2289 version except to change deprecated to fatal.

I don't have a particularly strong opinion, but I believe that the arguments parser is supposed to parse the arguments and then report on any semantic issues - as this GPR stands, and in present releases, ocamlc -vmthread -foo complains about not understanding what -foo is, whereas what you propose displays the removal of vmthreads error message. More confusingly, it would mean that ocamlc -foo -vmthread and ocamlc -vmthread -foo display different error messages (however correct each may be).

(Not that I'm in favour of the myriad references in Clflags, of course!)

@xavierleroy
Copy link
Copy Markdown
Contributor

Dear David,

With all due respect I think you're overengineering it :-) It is no problem that ocamlc -foo -vmthread and ocamlc -vmthread -foo display different error messages, as long as they display error messages, because they are now both erroneous. No need for a distinction between "syntactic" and "semantic" analysis of command-line flags, a distinction that is not obvious to me to begin with.

On the other hand, I feel strongly about keeping Clflags "clean", i.e. all references should correspond to actively-supported options. So, Clflags.use_vmthreads has to go.

@dra27
Copy link
Copy Markdown
Member Author

dra27 commented Mar 12, 2019

It is the first time I have overengineered something by not writing code 🙂

@dra27 dra27 force-pushed the restore-vmthreads-cli branch from 2a3695e to 6231ad9 Compare March 12, 2019 19:46
Copy link
Copy Markdown
Contributor

@xavierleroy xavierleroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me. Thank you for the changes.

@xavierleroy xavierleroy merged commit 6e84987 into ocaml:trunk Mar 13, 2019
@dra27 dra27 deleted the restore-vmthreads-cli branch July 6, 2021 14:05
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

Successfully merging this pull request may close these issues.

4 participants