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

Remove env_var and command_line from options #1240

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

wks
Copy link
Collaborator

@wks wks commented Nov 28, 2024

Removed from_env_var and from_command_line from MMTkOption because now all options can be set in both ways.

Replaced Options::set_from_command_line and Options::set_from_env_var with a single Options::set_by_string.

Moved several methods of Options out of the options! macro if they don't need to be generated via macro expansion. Now only two methods are generated by the macro.

  • set_by_string_inner: Requires matching field names against user-provided strings.
  • new: Initializing fields using default values.

In order to replicate the behavior that Options::read_env_var_settings silently ignores unrecognized option keys in MMTK_* environment variables, we introduced an error type SetOptionByStringError which Options::set_by_string_inner returns so that Options::read_env_var_settings and Options::bulk_set_by_string can behave differently when encountering invalid keys.

wks added 4 commits November 30, 2024 18:16
Remove env_var and command_line because they can all be set in both
ways.

Also renamed functions that set options by name, and removed "convenient
methods" in MMTKBuilder and memory_manager.
Require T in MMTKOption<T> to implemnt FromStr because we use
parse::<T>() anyway.

Move Default out of macro.

Update comments.
@wks wks force-pushed the fix/remove-envvar-cmdline branch from 8004a10 to 8941384 Compare November 30, 2024 13:14
@wks wks changed the title Refactor Options Remove env_var and command_line from options Nov 30, 2024
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.

1 participant