Suppose an argument must be a non-negative integer. If the actual argument is not an integer, this is a type_error. If it is a negative integer, it is a domain_error.
Typical borderline cases are predicates accepting a compound term,
e.g., point(X,Y)
. One could argue that the basic type is a
compound-term and any other compound term is a domain error. Most Prolog
programmers consider each compound as a type and would consider a
compound that is not point(_,_)
a type_error.