Next: Obsolete Suspension Facilities
Up: Advanced Control Features
Previous: The Top-Level Loop
  Index
The Cut and the Suspended Goals
It is very important to mention here the influence of non-logical predicates,
especially the
cut,
on the execution of delayed goals.
The cut relies on a fixed order of goal execution in that it discards
some choice points if all goals preceding it in the clause body have
succeeded.
If some of these goals are delayed, or if the head unification of the
clause with the cut wakes some nondeterministic delayed goals,
the completeness of the resulting program is lost
and there is no clean way to save it as long as the cut is used.
The user is strongly discouraged to use non-local cuts together with
coroutining, or to be precisely aware of their scope.
The danger of a cut is twofold:
- a cut can be executed if some calls preceding it in the clause
(or children of these calls) delay and they fail when they are woken
- the head unification of a clause with cuts can wake some delayed
goals.
If they are nondeterministic, the cut in the body of the waking clause
will commit even the woken goals
In order to detect these situations, the ECLiPSe debugger has an option
to print a warning whenever a cut in one of the above two conditions
is executed. These warnings can be toggled using the P command.
Next: Obsolete Suspension Facilities
Up: Advanced Control Features
Previous: The Top-Level Loop
  Index
Warwick Harvey
2004-08-07