built-in method

# `context/1`

## Description

    context(Context)

Returns the execution context for a predicate clause using the term `logtalk(Head,ExecutionContext)` where `Head` is the head of the clause containing the call. This private predicate is mainly used for providing an error context when type-checking predicate arguments. The `ExecutionContext` term 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.

Warning

As the execution context term includes the clause head, the head of the clause calling the `context(Context)` method cannot contain the `Context` variable as that would result in the creation of a cyclic term. The compiler detects and reports any offending clauses by throwing a `representation_error(cyclic_term)` error.

## Modes and number of proofs

    context(--callable) - one

## Errors

(none)

## 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