Skip to content

refactor: rename exe_trace to concrete_playback and det_vals to concrete_vals#1548

Merged
sanjit-bhat merged 3 commits intomodel-checking:mainfrom
sanjit-bhat:big-rename
Aug 18, 2022
Merged

refactor: rename exe_trace to concrete_playback and det_vals to concrete_vals#1548
sanjit-bhat merged 3 commits intomodel-checking:mainfrom
sanjit-bhat:big-rename

Conversation

@sanjit-bhat
Copy link
Contributor

@sanjit-bhat sanjit-bhat commented Aug 18, 2022

Description of changes:

See title. Note: there's still probably things that I forgot to rename, but I tried my best to catch as much as I could in this pass.

Resolved issues:

Resolves #1505, renaming.

Testing:

This change is tested by the existing tests in tests/ui/concrete-playback. I manually re-ran those tests to make sure they played back correctly.

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. Very thorough!

I really wish we could make a few changes to the way we take arguments. See my comment below but I'm afraid the change might require us to move out of structopt. Not sure.

I would prefer using print instead of JustPrint to make it less verbose. None of those are blockers, so I'm approving the PR.

Thanks

/// Generate executable trace test case and print it to stdout.
/// Generate concrete playback unit test and either 1) just print it to stdout or 2) add it in-place to the source code.
/// This option does not work with `--output-format old`.
#[structopt(
Copy link
Contributor

Choose a reason for hiding this comment

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

I couldn't figure out good ways with structopt to do the following:

  • Use kebab-case for the arguments.
  • Allow users to use --concrete-value without an argument (and default it to print).

I tried clap-rs/clap#2945 (reply in thread) to rename the arguments and clap-rs/clap#892 to make the argument optional but couldn't get them to work. Maybe they only work with clap directly.

@tedinski any suggestions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know how to use kebab-case for the arguments.

Copy link
Contributor Author

@sanjit-bhat sanjit-bhat Aug 18, 2022

Choose a reason for hiding this comment

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

I considered allowing users to use --concrete-value without an argument (and default to print). I spent about 30 mins looking through this, and I couldn't find any clean way to do it. Here's what I found:

  1. I could do it if I made concrete_playback: Option<Option<ConcretePlaybackMode>>. However, that has a really bad effect on code quality IMO. No concrete playback would be None, concrete playback in print mode would be Some(None), and concrete playback in in-place mode would be Some(Some(InPlace)). This doesn't match my intuition as a programmer.
  2. Even if I set the default value for ConcretePlaybackMode to be Print, structopt doesn't seem to be picking this up. When I leave just --concrete-playback, it errors out and says that I need to fill in something. I'm not allowed to add a default_value option to the structopt macro because the type is an Option.
  3. structopt issue #123 asks for the exact same thing. They closed it with a PR, but I can't seem to figure out how the PR actually fixes the issue.
  4. To create a custom parser that functions properly, it would need to take both the number of occurrences and the actual strings. There isn't support for such a parser yet.

Because I didn't find any clean way to implement this, I decided to force the user to specify either Print or InPlace. This isn't ideal, but it does have the plus-side of making the operating mode explicit.

@sanjit-bhat sanjit-bhat merged commit ec3026d into model-checking:main Aug 18, 2022
@sanjit-bhat sanjit-bhat deleted the big-rename branch August 18, 2022 23:09
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.

Rename exe trace to concrete playback and det vals to concrete vals

2 participants