This module infers meta-predicate properties by inspecting the clauses
of predicates that call other predicates. This is extremely useful for
program analysis and refactoring because many programs `in the wild'
have incomplete or incorrect meta-predicate information.
- See also
- - This library is used by prolog_walk_code/1 to improve the
accuracy of this analysis.
- To be done
- - Re-introduce some alias-analysis
- - Not all missing meta-declarations are interesting. Notably,
meta-predicates that are private and only pass meta-arguments
on behalve of a public meta-predicates do not need a declaration.
- inferred_meta_predicate(:Head, ?MetaSpec) is nondet
- True when MetaSpec is an inferred meta-predicate specification
for Head.
- infer_meta_predicate(:Head, -MetaSpec) is semidet
- True when MetaSpec is a meta-predicate specifier for the
predicate Head. Derived meta-predicates are collected and made
available through inferred_meta_predicate/2.
- meta_pred_args_in_clause(+Module, +Head, -MetaSpec) is nondet[private]
- annotate_meta_vars_in_body(+Term, +Module) is det[private]
- Annotate variables in Term if they appear as meta-arguments.
- To be done
- - Aliasing. Previous code detected aliasing for
- - We can make this nondet, exploring multiple aliasing
paths in disjunctions.
- annotate_meta_args(+Arg, +Arity, +Goal, +MetaSpec, +Module)[private]
- meta_annotation(+Head, -Annotation) is semidet[private]
- True when Annotation is an appropriate meta-specification for
Head.
- meta_arg(+AnnotatedArg, -MetaSpec) is det[private]
- True when MetaSpec is a proper annotation for the argument
AnnotatedArg. This is simple if the argument is a plain argument
in the head (first clause). If it is a compound term, it must
unify to _:_, otherwise there is no point turning it into a meta
argument. If the module part is then passed to a module
sensitive predicate, we assume it is a meta-predicate.
- combine_meta_args(+Heads, -Head) is det[private]
- Combine multiple meta-specifications.