Logtalk reference manual
Control construct: ^^/1
Contents > Reference Manual > Control Constructs > ^^/1

## ^^/1

#### Description

    ^^Predicate

Calls an imported or inherited predicate definition. The call fails if the predicate is declared but there is no imported and no inherited predicate definition. This control construct may be used within objects or categories in the body of a predicate definition. When used within a category, the predicate definition lookup is restricted to the extended categories.

The called predicate should be declared public or protected. It may also be declared private if within the scope of the entity where the method making the call is defined. When the predicate is declared but not defined, the message simply fails (as per the closed-world assumption).

This control construct is a generalization of the Smalltalk super keyword to take into account Logtalk support for prototypes and categories besides classes. The lookup for the predicate definition starts at the imported categories, if any. If an imported predicate definition is not found, the lookup proceeds to the ancestor objects.

The lookups for the predicate declaration and the predicate definition are performed using a depth-first strategy. Depending on the value of the `optimize` flag, these lookups are performed at compile time whenever sufficient information is available. When the lookups are performed at runtime, a caching mechanism is used to improve performance in subsequent calls.

#### Template and modes

    ^^+callable

#### Errors

Predicate is a variable:
  `instantiation_error`
Predicate is neither a variable nor a callable term:
  `type_error(callable, Predicate)`
Predicate, with predicate indicator Functor/Arity, is declared private:
  `permission_error(access, private_predicate, Functor/Arity)`
Predicate, with predicate indicator Functor/Arity, is not declared:
  `existence_error(predicate_declaration, Functor/Arity)`

#### Examples

    init :-
        assertz(counter(0)),
        ^^init.