Skip to content
This repository has been archived by the owner on Jan 30, 2019. It is now read-only.

Commit

Permalink
Document XCALL as "Quoted expressions".
Browse files Browse the repository at this point in the history
  • Loading branch information
wavexx committed Sep 12, 2014
1 parent 5e540c6 commit 8ae7d9a
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ The resulting ``bond.Bond`` class has the following methods:

Return a reference to an *single, unevaluated statement* of code, which can
be later used in eval(), eval_block() or as an *immediate* argument to call().
See `Quoted expressions`_.

``close()``:

Expand Down Expand Up @@ -305,6 +306,26 @@ exceptions when an exported function is called. Pay attention to the error
text/data in these cases, as it will contain several nested exceptions.


Quoted expressions
------------------

``bond`` has minimal support for quoted expressions, through the use of
``Bond.ref()``. ``ref()`` returns a reference to a unevaluated statement that
can be fed back to ``eval()``, ``eval_block()``, or as an *immediate* (i.e.:
not nested) argument to ``call()``. References are bound to the interpreter
that created them.

``ref()`` allows to "call" methods that take remote un-serializable arguments,
such as file descriptors, without the use of a support function and/or eval:

.. code:: python3
pl = make_bond('Perl')
pl.eval_block('open($fd, "<file.txt");')
fd = pl.ref('$fd')
pl.call('close', fd)
Language support
================

Expand Down Expand Up @@ -481,25 +502,6 @@ Limitations:
required (the "-i" flag is automatically provided).


Suspended evaluation
--------------------

``Bond`` has minimal support for suspended evaluation, through the use of
``Bond.ref()``. ``ref()`` returns a reference to an unevaluated statement that
can be fed back to ``eval()``, ``eval_block()``, or as an *immediate* (i.e.:
not nested) argument to ``call()``.

``ref()`` allows to "call" methods that take un-serializable arguments, such as
file descriptors, without the use of a support function:

.. code:: python3
pl = make_bond('Perl')
pl.eval_block('open($fd, "<file.txt");')
fd = pl.ref('$fd')
pl.call('close', fd)
Common limitations
------------------

Expand Down

0 comments on commit 8ae7d9a

Please sign in to comment.