Logtalk reference manual
Control construct: <</2

<</2

Description

Object << Goal

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 is mainly used for debugging and for writing object unit tests. This control construct can only be used when the read-only compiler option context_switching_calls is set to allow. Set this compiler option to forbid to disable this control construct.

Template and modes

+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)

Examples

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