Re: When are cond-expressions evaluated?

Le 2 jun 2014 à 11:46, c64zottel . <c64zottel@gmail.com> a écrit :

> if there is a statement like <state id="s" cond="a==7" />. When is the
> cond-expression evaluate? Every time a changes and s is active?
> Or just when an event occurs?

Never, because states don't have conditions.
Transitions do, and their condition is evaluated every time the transition could be enabled based on its event and target attributes alone, and only then. That means it occurs during the enabling phase of a microstep, the transition's parent must be active, and the algorithm hasn't already given up on transitions in that state. In particular, this means that different equally conformant algorithms may evaluate more or less conditions depending on how early they realize that they don't need to look at more transitions (you can make a complete list of enabled transitions and then do preemption, but you can also do some or all of preemption during enabling, and you can even compile preemption in advance).
It means that you should really avoid side-effects in conditions.

			David

Received on Monday, 2 June 2014 10:19:50 UTC