p/N is declared to be
then all calls to
p/N must be annotated
impure p(X1, X2, …, XN)
f/N is declared to be
then all applications of
must be obtained by unification with a variable
and the unification goal as a whole be annotated with
impure X = f(X1, X2, …, XN)
Any call or unification goal containing a non-local variable
any that appears in a negated context
(i.e., in a negation or in the condition of an if-then-else goal)
must be given an
because it may violate referential transparency.
Compound goals should not have purity annotations.
The compiler will report an error
if a required purity annotation is omitted from a call or unification goal
or if a
semipure annotation is used
impure annotation is required.
The compiler will report a warning
if a semipure goal is annotated with
or a pure goal is annotated with
The requirement that impure or semipure calls
be marked with
allows someone reading the code to tell which goals are not pure,
making code which relies on side effects somewhat less mysterious.
Furthermore, it means that
if a call is not preceded by
then the reader can rely on the call having a proper declarative semantics,
without hidden side-effects.