Logtalk reference manual
Built-in method: context/1

context/1

Description

context(Context)

Returns the execution context for a predicate call using the format logtalk(Call,ExecutionContext). Mainly used for providing a default error context when type-checking predicate arguments. The ExecutionContext should be regarded as an opaque term, which can be decoded using the logtalk::execution_context/7 predicate. Calls to this predicate are inlined at compilation time.

Template and modes

context(--callable)

Errors

Context is not a variable:
type_error(var, Context)

Examples

foo(A, N) :-
    % type-check arguments
    context(Context),
    type::check(atom, A, Context),
    type::check(integer, N, Context),
    % arguments are fine; go ahead
    ... .

See also

parameter/2, self/1, sender/1, this/1