-
Notifications
You must be signed in to change notification settings - Fork 313
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
Self Transitions #19
Comments
If you expect a self transition just check for the error. If you want to treat it as an error or not is up to you. |
Or did you want to do something more with a self transition? Callbacks etc. |
Yes, an error could be misleading in this case, I definitely see your point. Let's discuss this further. What changes do you suggest? Does the fact that no transition happened need to be fed back into one of the callbacks or something similar? |
I think the transition should happen, but the leave state and then enter state may not happen since it's just a self transition. The transition needs to be a first class citizen. Currently beforeEvent and afterEvent hides the actual transition logic that needs to occur. Adding one more callback called "doEvent" might be needed. |
I've just been bitten by this issue. Any progress on this? I'd also suggest that leave and enter state actually do fire, as the state machine is transitioning out of the state and back into the state - its more that the transition has occurred and resulted in the same state, rather than the event itself has fired. Example, think of a simple game with two players. You may want the game to transition between player turns: {Name: "PlayerEndsTurn", Src: []string{"player_turn"}, Dst: "player_turn"}, and have a callback for enter_ player_turn that setups up the state for each player on their turn. It's not the event that is important here, as there may be other events that trigger the transition to a new player_turn (such as the last possible piece movable by the player being moved). |
This is a deterministic state machine implementation. That's why every state can only have one dst. |
I'll close this, referring to the last comment. |
I still think this should be looked at. The comment from @ppwfx isn't correct or I'm misunderstanding what he's saying. While the implementation of this library is based on a determinstic fsm, a determinstic fsm allows for multiple transitions out of a state, and even back into the same state, for different input. We're not talking about allowing multiple transition from a state with the same input. That would make it a NFA. What this issue is about does not fall outside of a DFA. So in my case, we have an fsm where you have to upload at least one document, but you may need to upload multiple
You transition to |
any comments/updates on this? i think @pajacobs17 is right. currently we need to implement all self transitions ourselves (by handling the transition error) since we the lib is not supporting it which is a bit annoying. Compare: http://www.phon.ox.ac.uk/jcoleman/new_SLP/Lecture_1/FSMs.html chapter "self loops" |
Hi Team, The state machine is not supporting transition from and to if its same state. There is a business requirement to allow the state transition and trigger some events in case of the from and to state is same. Any recommendation here would be appreciated |
Self transitions don't seem to be supported. The following code snippet from fsm.go seems to consider self transitions as errors.
Perhaps I'm not using the fsm appropriately. any thoughts?
The text was updated successfully, but these errors were encountered: