-
Notifications
You must be signed in to change notification settings - Fork 34
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
bad naming for eventless transitions #40
Comments
Agreed. It seems silly to have:
Seems oxymoronic :) |
Well, your example condition's transition is both target less and event less. I don't have a use case in mind for this. However, in the timer switch example, there is a condition for a transition which does have a target but no event:
This will transition from state_on to state_off when m.user->timer >= 5 |
Oh I see. So, the use case is when you want a guard condition to be evaluated upon any event that may occur in the source state. I wouldn’t say that this is really eventless. An event has to occur, but you just don’t care which event it is. I’d offer the suggestion to call this void dispatch(event e = &state::any_event)
{
bool cont = dispatch_event(e);
while (cont) {
if ((cont = dispatch_event(&state::initial)));
else if ((cont = dispatch_event(&state::any_event)));
else if (model.event_queue.size()) cont = dispatch_event(model.event_queue.front()), model.event_queue.pop(), cont |= !model.event_queue.empty();
else break;
}
} If you like this, I'd be happy to prepare a PR |
I think, But it's a little bit worse: <?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" binding="early" name="cond" datamodel="cplusplus">
<state id="State_1">
<transition type="external" target="State_2" cond="isOn"/>
<transition type="external" target="State_2" cond="isOn2"/>
</state>
<state id="State_2"/>
<datamodel>
<data id="bool isOn" expr="false"/>
<data id="bool isOn2" expr="false"/>
</datamodel>
</scxml>
I think, if the condition is defined in the scxml, an eventless transition should get some kind of identifier (simple counter). |
Thanks for your observation :-) |
'sc::state::unconditional' is bad naming. The transition is not unconditional, but eventless. Consider to change this to for example 'sc::state::eventless' or 'sc::state::none'
The text was updated successfully, but these errors were encountered: