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

Fix parse_argv usage #83

Closed
aantron opened this issue Sep 4, 2019 · 1 comment · Fixed by #84
Closed

Fix parse_argv usage #83

aantron opened this issue Sep 4, 2019 · 1 comment · Fixed by #84

Comments

@aantron
Copy link
Collaborator

aantron commented Sep 4, 2019

This was just merged in #82. However, the new code is not quite correct:

  1. parse_argv raises exceptions instead of internally executing exit.
  2. parse_argv should be called with ~current:(ref 0).

Perhaps the right way to do this is to restore the former signature of run_main, and leave it as the function that calls exit, and provide a new function run_main_with_argv that will take an argv argument and raise exceptions. I actually would prefer run_main_with_argv not call exit, because that allows linking a PPX directly into a test suite, which improves testing performance.

Another option is to leave run_main with ?argv, but it will be have differently, depending on whether ~argv is supplied: if not supplied, run_main will call exit, and if supplied, it will raise exceptions. This could be surprising to users of the API, however.

@diml, what do you think about the last two paragraphs?

I'll be happy to submit a PR, considering your preference.

@aantron
Copy link
Collaborator Author

aantron commented Sep 5, 2019

I went with the first option in #84, because three functions need the exit behavior change, and it is easier to have three optional arguments, than duplicate all three functions and have six entry points.

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 a pull request may close this issue.

1 participant