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

Make state_transition not return post-state #2104

Merged
merged 2 commits into from
Nov 3, 2020

Conversation

hwwhww
Copy link
Contributor

@hwwhww hwwhww commented Oct 15, 2020

Issue

  1. It's arguable that the mutability side effect is smell (see Side effects in functions #1932 discussion). Although I personally want to remove the side effect, we decide to keep it for now for the code concision and stability.
  2. What worse than the mutability side effect is that the state_transition provides two patterns: (i) it mutates the given state and also (ii) returns the post-state. We're using (i) in the whole specs and (ii) only exists in state_transition.

How did I fix it

Make state_transition not return post-state. The given pre-state should have been mutated to post-state.

@hwwhww hwwhww added general:presentation Presentation (as opposed to content) general:simplification labels Oct 15, 2020
@hwwhww hwwhww requested a review from djrtwo October 15, 2020 08:14
Copy link
Contributor

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

taking back my approval. going to make sure this isn't used in any unexpected way in tests/test-gen

@djrtwo djrtwo merged commit 6b44f63 into v1.0-candidate Nov 3, 2020
@djrtwo djrtwo deleted the state_transition_patch branch November 3, 2020 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general:presentation Presentation (as opposed to content) general:simplification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants