built-in method
predicate_property/2
ï
Descriptionï
predicate_property(Predicate, Property)
Enumerates, by backtracking, the properties of a visible object predicate. Properties for predicates not declared using a scope directive are not enumerated. The valid predicate properties are listed in the language grammar section on predicate properties and described in the User Manual section on predicate properties.
When Predicate
is listed in a uses/2 or
use_module/2 directive, properties are enumerated for
the referenced object or module predicate.
When Predicate
is bound at compile time to a (:)/2
term, this
predicate enumerates properties for module predicates (assuming that
the backend Prolog compiler supports modules).
Modes and number of proofsï
predicate_property(+callable, ?predicate_property) - zero_or_more
Errorsï
Predicate
is a variable:instantiation_error
Predicate
is neither a variable nor a callable term:type_error(callable, Predicate)
Property
is neither a variable nor a valid predicate property:domain_error(predicate_property, Property)
Examplesï
predicate_property(Predicate, Property)
::predicate_property(Predicate, Property)
Object::predicate_property(Predicate, Property)
An example of enumerating properties for locally visible object predicates. These include predicates listed using uses/2 and use_module/2 directives:
:- object(foo).
:- uses(bar, [
baz/1, quux/2
]).
:- public(pred/1).
pred_prop(Pred, Prop) :-
predicate_property(Pred, Prop).
:- end_object.
| ?- foo::pred(baz(_), Prop).
Prop = logtalk ;
Prop = scope(public) ;
Prop = public ;
Prop = declared_in(bar) ;
...
See also