fsm
fsm copied to clipboard
Preconditions, PostConditions, transitions, onEntry, onExit
Preconditions are handled using "beforeEvent" Postconditions are handled using "afterEvent"
State support enterState and leaveState where appropriate state logic occurs I think there needs to support for "doTansition" where the transition logic would occur.
Thoughts?
Not sure what you want to do in "doTransition". Can you provide an example?
BeforeEvent gives and opportunity to write guards to protect the event from occurring. AfterEvent gives the opportunity to write logic to check the outcome
DoTransition, perhaps should be called "DoEvent" and should leverage the callback mechanism. Adding one additional callback to support "doEvent" would be good.
Now I understand! If you want you are more than welcome to submit a PR so we can discuss it further.
ok, I'll modify my copy of fsm.go and put that functionality into it. Then I'll create a pull request once I get the basics in place
Sounds good!
perhaps beforeEvent returning an error cancels the transition?