2.2. Variable

A variable may occur on its own as an expression. Execution of a variable publishes the value bound to that variable, and then halts.

The variable might be executed before it is bound to a value. This could occur if the variable was introduced by a pruning combinator, or if it is the name of a defined function whose body contains unbound variables. In this case, execution of that variable blocks until the variable is bound.

If the variable was introduced by a pruning combinator, and the right side of that combinator halts before the variable becomes bound, execution of the variable also halts.

2.2.1. Syntax

[59]Variable::= Identifier  

2.2.2. Type

The type of a variable expression is the type given to it by the current typing context.

2.2.3. Examples

Blocking on a Variable
{-
  Publish the values bound to two variables.
  One of the bindings occurs only after some time has passed,
  so execution of that variable blocks.
-}

val x = 0
val y = Rwait(1000) >> 1

x | y

{-
OUTPUT:
0
1
-}

2.2.4. Related Links

Related Tutorial Sections