Skip to content

Add SetState to modify the current state #25

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

Merged
merged 2 commits into from
Jan 16, 2018
Merged

Conversation

itsarbit
Copy link
Contributor

For some cases, instead of maintaining the state changes, we only need the state diagram. In other words, we allow callers to maintain the state change. Therefore, we allow the caller to modify the current state, so we can jump to a specific state in anytime. In other cases, by opening this API, we can easily implement test cases in different states.

@maxekman
Copy link
Member

I can see how this can be useful, but I'm afraid that it can also be easily abused. Do you have an idea for another name for the method? The comment should also reflect the fact that no callbacks will be called.

@itsarbit
Copy link
Contributor Author

You are right about being abused. Do you have any idea to minimize the risk? About naming, how about SetCurrent, Current, or simply State( ). I am also considering expose allEvents map to the FSM struct's field, so I can check whether the jumping state is valid. How do you think? About comment, I will update as suggested. Thanks.

@itsarbit
Copy link
Contributor Author

Hi, any updates for this pull request?

@maxekman maxekman merged commit 116126e into looplab:master Jan 16, 2018
@maxekman
Copy link
Member

Thanks, and sorry for the delay.

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.

2 participants