built-in method
consistency_error/3
ï
Descriptionï
consistency_error(Consistency, Argument1, Argument2)
Throws a consistency error. Used when two directives or predicate arguments are
individually correct but together are not consistent. For example, a predicate
and its alias having different arity in a uses/2
directive. This built-in
method is declared private and thus cannot be used as a message to an object.
Calling this predicate is equivalent to the following sequence of goals:
...,
context(Context),
throw(error(consistency_error(Consistency,Argument1,Argument2), Context)).
This allows the user to generate errors in the same format used by the runtime.
Possible values representing Consistency
checks include:
same_arity
same_number_of_parameters
same_number_of_arguments
same_closure_specification
Modes and number of proofsï
consistency_error(+atom, @nonvar, @nonvar) - error
Errorsï
When called:
consistency_error(Consistency, Argument1, Argument2)
Examplesï
% code that will trigger consistency errors when compiled:
% predicates (and non-terminals) aliases must have the same
% arity as the original predicates (and non-terminals)
:- uses(list, [
member/2 as in/1
]).
% meta-predicate templates should be consistent with how closures
% are used regarding the number of additional arguments
:- public(p/2).
:- meta_predicate(p(1, *)).
p(G, A) :-
call(G, A, 2).