Logtalk reference manual
Control construct: <</2
Contents > Reference Manual > Control Constructs > <</2

## <</2

#### Description

    Object<<Message
    {Proxy}<<Message

Calls a goal within the context of the specified object. Goal is called with the execution context (sender, this, and self) set to Object. Goal may need to be written within brackets to avoid parsing errors due to operator clashes. This control construct should only be used for debugging or for writing unit tests. This control construct can only be used for objects compiled with the compiler option `context_switching_calls` set to `allow`. Set this compiler option to `deny` to disable this control construct and thus preventing using it to break encapsulation.

The `{Proxy}<<Message` syntax allows simplified access to parametric object proxies. Its operational semantics is equivalent to the goal conjunction `(call(Proxy), Proxy<<Message)`. I.e. `Proxy` is proved within the context of the pseudo-object `user` and, if successful, the goal term is used as a parametric object identifier. Exceptions thrown when proving `Proxy` are handled by the `<</2` control construct. This syntax construct supports backtracking over the `{Proxy}` goal.

Caveat: although the goal argument is fully compiled before calling, some of the necessary information for the second compiler pass may not be available at runtime.

#### Template and modes

    +object_identifier<<+callable
    {+object_identifier}<<+callable

#### Errors

Either Object or Goal is a variable:
  `instantiation_error`
Object is neither a variable nor a valid object identifier:
  `type_error(object_identifier, Object)`
Goal is neither a variable nor a callable term:
  `type_error(callable, Goal)`
Object does not contain a local definition for the Goal predicate:
  `existence_error(procedure, Goal)`
Object does not exist:
  `existence_error(object, Object)`
Object was created/compiled with support for context switching calls turned off:
  `permission_error(access, database, Goal)`

#### Examples

    test(member) :-
        list << member(1, [1]).