## 10.1 General

The module `Value` contains two general control procedures.

`Wait`

  > `{Value.wait` `+X``}`

  blocks until `X` is determined.

`WaitOr`

  > `{Value.waitOr` `X``` `Y``}`

  blocks until at least one of `X` or `Y` is determined.

`!!`

  > `{Value.'!!'` `X``` `Y``}`

  returns a future `Y` for `X`, i. e., a read-only placeholder for `X`.

`byNeed`

  > `{Value.byNeed` `+P``` `X``}`

  creates a future `X`. When `X` is requested (i. e., some thread blocks on `X`), the unary procedure `P` is applied to a fresh variable `Y` in a new thread. When the application of `P` is fully reduced, the variable associated with `X` is bound to `Y`.

`byNeedFail`

  > `{Value.byNeedFail` `+E``` `X``}`

  creates a failed future `X` encapsulating exception `E`. Whenever `X` is requested (see above), in particular, whenever a thread synchronizes on `X`, exception term `E` is raised. This is convenient in concurrent designs: if a concurrent generator encounters a problem while computing a value, it may catch the corresponding exception, package it as a failed future and return the latter instead. Thus each consumer will be able to synchronously handle the exception when it attempts to use the ``failed'' future. For example, the module manager returns failed futures for modules that cannot be found or linked.