control construct




Calls a predicate definition in this. The argument must be a callable term at compile time. The predicate must be declared (by a scope directive). This control construct provides access to predicate definitions in this from categories. For example, it allows overriding a predicate definition from a complementing category with a new definition that calls goals before and after calling the overriden definition (the overriding definition is sometimes described in other programming languages as an around method). When used within an object, it’s the same as calling its argument.

Modes and number of proofs

@ +callable - zero_or_more


Predicate, with predicate indicator Name/Arity, is not declared:
existence_error(predicate_declaration, Name/Arity)


Assuming an object declaring a make_sound/0 predicate, define an around method in a complementing category:

make_sound :-
    write('Started making sound...'), nl,
    write('... finished making sound.'), nl.

See also

(::)/2, (::)/1, []/1