[ Control | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

exit_block(++TagExit)

Continues the program at the recovery procedure of the block/3 predicate whose Tag argument unifies with TagExit.
TagExit
An atom, integer or handle.

Description

Can only occur after block(Goal,Tag, Recovery) has been invoked. First Goal is called and if this succeeds then block/3 succeeds. If Goal fails then so does the call of block/3. If, however, during the execution of Goal there is a call of exit_block(TagExit) such that Tag unifies with TagExit, then block/3 calls the goal Recovery, and succeeds or fails according to whether Recovery succeeds or fails. If Tag does not unify with TagExit, the system continues looking for an earlier invocation of block/3.

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(4) instantiation fault
TagExit is uninstantiated.
(5) type error
TagExit is instantiated but not to an atom, integer or handle.
(230) uncaught exception
TagExit does not unify with a Tag of any uncompleted call of block/3.

Examples

      % A variable Tag catches all exit_blocks
      ?- block(exit_block(hello), T, writeln(recover(T))).
      recover(hello)
      T = hello
      Yes (0.00s cpu)

      % An instantiated Tag catches only matching exit_blocks
      ?- block(exit_block(hello), hello, writeln(recovered)).
      recovered
      Yes (0.00s cpu)

      ?- block(exit_block(hello), world, writeln(recovered)).
      uncaught exception in exit_block(hello)
      Abort


Error:
      exit_block("a").                (Error 5).
      exit_block(a).                  (Error 230).

See Also

block / 3