Call goals with reified (exit) ports.

Author(s): Jose F. Morales.

Predicates to delay the execution of the (exit) port of a goal. This is useful to introduce side-effects at selected points (e.g., clean-ups before goal exit in failure or exception conditions).

Usage and interface

Documentation on exports

exit_port(Result)

Exit port of a goal execution, defined as:

  • success: goal succeeded
  • failure: goal failed
  • exception(E): goal threw an exception E

Usage:once_port_reify(Goal,Result)

Execute once(Goal) (alternatives are cut) and obtain its execution port Port, which can be continued with port_call/1.

The sequence (once_port_reify(Goal,P),Cleanup,port_call(P)) is semantically equivalent to once(Goal), but executes Cleanup goals in case of success, failure, and exception.

Meta-predicate with arguments: once_port_reify(goal,?).

PREDICATEport_call/1

Usage:port_call(Result)

Succeed, fail, or throw the exception from Result (see once_port_reify/2).

Documentation on imports

This module has the following direct dependencies:

Known bugs and planned improvements

  • Improve name, move elsewhere?