Logtalk reference manual
Control construct: ::/1

::/1

Description

::Predicate

::(Predicate1, Predicate2, ...)

::(Predicate1; Predicate2; ...)

Send a message to self. Only used in the body of a predicate definition. The argument should match a public or protected predicate of self. It may also match a private predicate if the predicate is within the scope of the object where the method making the call is defined, if imported from a category, if used from inside a category, or when using private inheritance. We can also send a set of messages to self. The "," and ";" in the list have the usual Prolog meaning.

Template and modes

::+messages

Errors

Predicate is a variable:
instantiation_error
Predicate is declared private:
permission_error(access, private_predicate, Predicate)
Predicate is not declared:
existence_error(predicate_declaration, Predicate)

Examples

area(Area) :-
    ::width(Width),
    ::height(Height),
    Area is Width*Height.