Link Search Menu Expand Document

Oters - Execution Model


One of the chief design goals of Oters is that the underlying execution model should be completely abstracted away. A GUI program should simply be a series of declarative statements and the programmer should trust the language’s interpreter to execute these as intended.

Nevertheless, I include this section to explain how the interpreter evaluates the user’s statements and runs any streams defined indefinitely.

Executing a Program

The first thing the interpreter does is evaluate all the program statements to values. From these, all those that evaluate to streams are picked out as these need to be continuously updated. The “main” loop then executes. This loop updates all the streams automatically at maximum 60 frames per second, and executes as follows:

  • All statements and resulting streams are executed in program order. This is why statements must be in dependency order. We cannot evaluate a stream before its input has been evaluated this time step.
  • When a stream is evaluated, it gets reduced to a tuple:
    • The head of the tuple is the result of the computation in the current time step.
    • The tail is a reference to the computation that must be done in the next time step.
  • Once all streams are done evaluating, the tuples get substituted for their tails (i.e. next time step’s computation).
  • These are subsequently evaluated in the next iteration of the loop.