Reactive scripts provide a flexible approach, allowing parallelism, distribution, object orientation, and preemption primitives.
The language contains an original combination of event-driven synchronous programming with broadcast communication and object based programming, including dynamic creation of objects.
Here are the basic commands of reactive scripts (see[1] for a full description):
An important point however is that the action controlled by the absence of an event will be delayed to the next reaction, following the absence decision principle which states that reaction to absence is always postponed to the next instant. The end of the reaction is the precise moment one is sure the event is definitely absent and not to delay reactions to event absences would cause trouble (often called ``causality problems''), as in:
await not E;generate E
where E would be generated during the same reaction it is absent. This would violate the basic broadcast hypothesis of reactive scripts, which states that the presence/absence of an event is the same in the whole system.
await E;stop;await E;{Out.println("Two!"}
A problem would appear if a loop body would terminate in the same reaction it is started (one speaks of an ``instantaneous loop''), as in:
loop {System.out.println("OK!")} end
Execution would cycle producing infinitely many OK!, and would prevent the interpretor to terminate the current reaction.
Instantaneous loops are detected at run time.
when E then
generate F
else
generate G
end
Event F is generated if E occurs in the current reaction; otherwise, G is generated in the next reaction.
do
await E;{System.out.println("E!")}
||
await F;{System.out.println("F!")}
until G;
{Out.println("Terminated!")}
If G does not occurs before both E and F does, then all works as if the until command was not there: E! is printed as soon as E occurs, F! is printed as soon as F occurs, and Terminated! is printed simultaneously with the last event, as then the body of the until terminates. On the contrary, if G occurs while E or F have not yet occurred, then the until command is exited at the next reaction and Terminated! is printed at that time.
An ``actual'' part can be added to a until command, to be executed only in case of actual preemption.
control
loop {System.out.println("OK!")};stop end
by E