-?-> must occur at the beginning of the clause body, directly behind the :- symbol, and it must be followed by a non-empty body. Matching clauses with no body must use true/0 after the matching operator.
The matching operator can be also used to decompose attributed variables. When an attributed variable occurs in the head of a matching clause, it is not unified with the call argument (which would trigger the unification handlers) but instead, the call argument is decomposed into the variable and its attribute(s):
get_attr(X{A}, Attr) :- -?-> A = Attr.This predicate can be used to return the attribute of its argument if it is an attributed variable and to fail if it is not.
Clause matching is not supported by dynamic predicates. A run-time exception will be raised when executing a matching clause head that is dynamic.