Did you know ... Search Documentation:
block.pl -- Block: declare suspending predicates
PublicShow source

This module provides SICStus Prolog-compatible :- block BlockSpec, ... declarations for delaying predicate calls if certain arguments are unbound.

See also
- https://sicstus.sics.se/sicstus/docs/3.12.11/html/sicstus/Block-Declarations.html
Source block +Heads
Declare predicates to suspend on certain modes. The argument is, like meta_predicate/1, a comma-separated list of modes (BlockSpecs). Calls to the predicate is suspended if at least one of the conditions implies by a blockspec evaluated to true. A blockspec evaluated to true iff all arguments specified as `-' are unbound.

Multiple BlockSpecs for a single predicate can appear in one or more :- block declarations. The predicate is suspended untill all mode patterns that apply to it are satisfied.

The implementation is realised by creating a wrapper that checks the block conditions and either calls the original predicate immediately (if none of the block conditions were true) or uses attributed variables to delay re-evaluating the block condition until any of the arguments in question are bound.

Compatibility
- SICStus Prolog