Logtalk reference manual
Control construct: {}/1

{}/1

Description

{Term}
{Goal}

This control construct allows the programmer to bypass the Logtalk compiler. It can be used to wrap a source file term or a goal. It can also be used as a message to any object. In the case of a goal, it is opaque to cuts and the argument is called within the context of the pseudo-object user. It is also possible to use {Closure} as the first argument of call/2-N calls. In this case, Closure will be extended with the remaining arguments of the call/2-N call in order to construct a goal that will be called within the context of user.

This control construct may also be used in place of an object identifier when sending a message. In this case, the result of proving its argument as a goal (within the context of the pseudo-object user) is used as an object identifier in the message sending call.

Template and modes

{+callable}

Errors

Term or Goal is a variable:
instantiation_error
Term or Goal is neither a variable nor a callable term:
type_error(callable, Goal)

Examples

{:- load_foreign_resource(file)}.

N1/D1 < N2/D2 :-
    {N1*D2 < N2*D1}.

call_in_user(F, X, Y, Z) :-
    call({F}, X, Y, Z).

| ?- {circle(Id, Radius, Color)}::area(Area).
...

| ?- logtalk::{write('Hello world!'), nl}.
Hello world!
yes