rvar


rvar(r, obj)
      

Return an unbound reactive variable.

Reactive variables are used in writing declarative concurrent programs. A newly initialized reactive variable will be in an unbound state. If a task requires the value of a reactive variable, it will wait until that variable is bound. This binding should happen in another task. Thus reactive variables can act as a simple mechanism for passing values between tasks. A reactive variable once assigned cannot be reassigned a new value. It is this property that makes them useful in declarative concurrency.

The operator ? can be used instead of rvar for creating a new unbound reactive variable.

Examples:


let x = ?
!showln(?x) // task waits until `x` is bound.
?x = 'hello //  `x` is bound to a value, unblocking the waiting task.
//> hello
      

Also see:

rbind
rget


Core Module Index | Contents