dynamic(Name/Arity) dynamic((Name/Arity, ...)) dynamic([Name/Arity, ...]) dynamic(Entity::Name/Arity) dynamic((Entity::Name/Arity, ...)) dynamic([Entity::Name/Arity, ...]) dynamic(Module:Name/Arity) dynamic((Module:Name/Arity, ...)) dynamic([Module:Name/Arity, ...]) dynamic(Name//Arity) dynamic((Name//Arity, ...)) dynamic([Name//Arity, ...]) dynamic(Entity::Name//Arity) dynamic((Entity::Name//Arity, ...)) dynamic([Entity::Name//Arity, ...]) dynamic(Module:Name//Arity) dynamic((Module:Name//Arity, ...)) dynamic([Module:Name//Arity, ...])
Declares dynamic predicates and dynamic grammar rule non-terminals. Note that an object can be static and have both static and dynamic predicates/non-terminals. When the dynamic predicates are local to an object, declaring them also as private predicates allows the Logtalk compiler to generate optimized code for asserting and retracting predicate clauses. Categories can also contain dynamic predicate directives but cannot contain clauses for dynamic predicates.
The predicate indicators (or non-terminal indicators) can be explicitly qualified with an object, category, or module identifier when the predicates (or non-terminals) are also declared multifile.
Note that dynamic predicates cannot be declared synchronized (when necessary, declare the predicates updating the dynamic predicates as synchronized).
Some backend Prolog compilers declare the atom
dynamic as an
operator for a lighter syntax. But this makes the code non-portable
and is therefore a practice best avoided.
Template and modes¶