term_expansion(Term, Expansion)
Defines an expansion for a term. This predicate, when defined, is automatically called by the expand_term/2
method. Use of this predicate by the expand_term/2
method may be restricted by using a scope directive for it. The term_expansion/2
clauses are only used by the expand_term/2
method if they are within the scope of the sender. When that is not the case, the expand_term/2
method only uses the default expansions. The term_expansion/2
predicate may return a list of terms.
Term expansion may be used either by calling the expand_term/2
method explicitly or by using hook objects. Clauses for the term_expansion/2
predicate defined within an object or a category are never used in the compilation of the object or the category itself. When used in hook objects, any expanded term wrapped in the {}/1
compiler bypass control construct will not be further compiled but used as-is.
term_expansion(+nonvar, -nonvar) term_expansion(+nonvar, -list(nonvar))
(none)
(none)