Next: , Previous: , Up: Pragmas   [Contents]


20.4 No determinism warnings

Declarations of the forms

:- pragma no_determinism_warning(pred(Name/Arity)).
:- pragma no_determinism_warning(func(Name/Arity)).

tell the compiler not to generate any warnings about the determinism declarations of procedures of the predicate or function with name Name and arity Arity not being as tight as they could be.

pragma no_determinism_warning’ declarations are intended for use in situations in which the code of a predicate has one determinism, but the declared determinism of the procedure must be looser due to some outside requirement. One such situation is when a set of procedures are all possible values of the same higher-order variable, which requires them to have the same argument types, modes, and determinisms. If (say) most of the procedures are det but some are erroneous (that is, they always throws an exception), the procedures that are declared det but whose bodies have determinism erroneous will get a warning saying their determinism declaration could be tighter, unless the programmer specifies this pragma for them.