Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
research:software:lrp [2016/12/21 15:52] – [Advanced Features] jfabryresearch:software:lrp [2016/12/21 16:16] – [Advanced Features] jfabry
Line 209: Line 209:
  
 === Exit transitions === === Exit transitions ===
 +
 +In a nested machine it is possible to define transitions that go to a state of the parent machine, effectively exiting the nested machine. Such transitions are like normal transactions, except that their keyword is ''exit'' and the destination state should be a state of the parent machine. Note that exit transitions are in fact syntactic sugar.
 +
 +A simple example is as follows. As soon as the ''out'' variable is set to ''true'', the nested machine is exit.
 +<code>
 +(machine root
 + (var out := [false])
 + (state one
 + (machine nested
 + (state onen)
 + (exit goout onen->two)
 + (event goout [out]))
 + (onentry (spawn nested onen))
 + )
 + (state two)
 +)
 +(spawn root one)
 +</code>
  
 === Eventless transitions === === Eventless transitions ===
 +
 +It can become tedious for transitions to need an event as a trigger, since it requires the definition of an event as a separate statement. This is especially tedious when the transition is the only that references that event. To ease this tedium, transitions also accept a block instead of an event name. This block should return true for the transition to trigger. 
 +
 +Eventless transitions are in fact syntactic sugar: an event is generated and added to the machine, with as action block the block that was specified in the transition, and the transition instead then refers to that event.
  
 === User interface: Jump to and Transition to === === User interface: Jump to and Transition to ===