Runtime Variable
Runtime #Constant
Runtime Procedure() declaration
Runtime Enumeration declaration
For advanced programmers. Runtime is used to create runtime accessible list of programming objects like variables, constants and procedures. Once compiled a program doesn't have variable, constant or procedure label anymore as everything is converted into binary code. Runtime enforces the compiler to add an extra reference for a specific object to have it available trough the Runtime library. The objects can be manipulated using their string reference, even when the program is compiled.

To illustrate the use of Runtime: the Dialog library use it to access the event procedure associated to a gadget. The name of the procedure to use for the event handler is specified in the XML file (which is text format), and then the dialog library use GetRuntimeInteger() to resolve the procedure address at runtime. It's not needed to recompile the program to change it.

Another use would be adding a small realtime scripting language to the program, allowing easy modification of exposed variables, using runtime constants values. While it could be done manually by building a map of objects, the Runtime keyword allows to do it in a standard and unified way.

Example: Procedure

  Runtime Procedure OnEvent()
    Debug "OnEvent"

  Debug GetRuntimeInteger("OnEvent()") ; Will display the procedure address

Example: Enumeration

  Runtime Enumeration
    #Constant1 = 10

  Debug GetRuntimeInteger("#Constant1")
  Debug GetRuntimeInteger("#Constant2")
  Debug GetRuntimeInteger("#Constant3")

Example: Variable

  Define a = 20
  Runtime a

  Debug GetRuntimeInteger("a")
  SetRuntimeInteger("a", 30)
  Debug a ; the variable has been modified