Did you know ... | Search Documentation: |
Pack logtalk -- logtalk-3.85.0/manuals/_sources/refman/control/external_call_1.rst.txt |
.. This file is part of Logtalk https://logtalk.org/ SPDX-FileCopyrightText: 1998-2024 Paulo Moura <pmoura@logtalk.org> SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
.. rst-class:: align-right
control construct
.. index:: pair: {}/1; Control construct .. _control_external_call_1:
{}/1
::
{Goal} {Closure} {Term}
This control construct allows the programmer to bypass the Logtalk compiler (including its linter but not its optimizer) in multiple contexts:
user
pseudo-object.user
pseudo-object with the resulting term being used as an object identifier
in the message sending goal. This feature is mainly used with
:term:`parametric objects <parametric object>` when their identifiers
correspond to predicates defined in user
... note::
This control construct is opaque to cuts when used to wrap a goal (thus ensuring the same semantics independently of the argument being bound at compile time or at runtime).
::
{+callable} - zero_or_more
| Goal
is a variable:
| instantiation_error
| Goal
is neither a variable nor a callable term:
| type_error(callable, Goal)
|
| Closure
is a variable:
| instantiation_error
| Closure
is neither a variable nor a callable term:
| type_error(callable, Closure)
|
| Term
is a variable:
| instantiation_error
| Term
is neither a variable nor a callable term:
| type_error(callable, Term)
::
% overload the standard (<)/2 operator by % calling its standard built-in definition: N1/D1 < N2/D2 :- {N1*D2 < N2*D1}.
% call a closure in the context of "user":
call_in_user(F, X, Y, Z)
:-
call({F}, X, Y, Z)
.
% bypass the compiler for a proprietary backend directive:
{:- load_foreign_resource(file)
}.
% use parametric object proxies:
| ?- {circle(Id, Radius, Color)
}::area(Area)
.
...
% use Prolog built-in predicates as messages:
| ?- logtalk::{write('hello world!')
, nl}.
hello world!
yes