next up previous contents index
Next: DCG Grammar rules Up: Built-in predicates Previous: Notes on signal handling   Contents   Index

The `block' control-structure

The block3 predicate and friends have been introduced before ISO compatible catch3 exception handling for compatibility with some Prolog implementation. The only feature not covered by catch3 and throw1 is the posibility to execute global cuts. New code should use catch3 and throw1 to deal with exceptions.

block3+Label, +Goal, -ExitValue Execute Goal in a block. Label is the name of the block. Label is normally an atom, but the system imposes no type constraints and may even be a variable. ExitValue is normally unified to the second argument of an exit2 call invoked by Goal. exit2+Label, +Value Calling exit2 makes the innermost block which Label unifies exit. The block's ExitValue is unified with Value. If this unification fails the block fails. fail1+Label Calling fail1 makes the innermost block which Label unifies fail immediately. Implemented as
\begin{code}
fail(Label) :- !(Label), fail.
\end{code}

1+Label Cut all choice-points created since the entry of the innermost block which Label unifies.


next up previous contents index
Next: DCG Grammar rules Up: Built-in predicates Previous: Notes on signal handling   Contents   Index
Dr. Richard Botting 2001-12-12