diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2017-11-18 17:58:33 -0500 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2017-11-18 17:59:14 -0500 |
| commit | 8d289bffdd2bf2062a6677530c4a4226175d87b2 (patch) | |
| tree | 6bf97eae7dbc91b80f04f84c63d269892885205a /README.rst | |
| parent | cd0a85b468b4e125000d2636df0d44e5f8e2b622 (diff) | |
Replace the registry mega-tuple with a type.
Add some missing builtins:
* and
* or
* uncons
Diffstat (limited to 'README.rst')
| -rw-r--r-- | README.rst | 33 |
1 files changed, 11 insertions, 22 deletions
@@ -176,39 +176,28 @@ helper ultimately calls that module's ``wrap_void`` to wrap the function, and wrapped.) If you prefer to manually bind functions using ``bind``, they must be wrapped appropriately. -Finally Actinide can bind specially-crafted Python modules. If a module -contains top-level symbols named ``ACTINIDE_BINDINGS``, ``ACTINIDE_VOIDS``, -``ACTINIDE_FNS``, and/or ``ACTINIDE_BUILTINS``, it can be passed to the -session's ``bind_module`` method. The semantics of each symbol are as follows: - -* ``ACTINIDE_BINDINGS`` is a list of name, value pairs. Each binding binding - will be installed verbatim, without any function mangling, as if by - ``session.bind``. - -* ``ACTINIDE_VOIDS``, ``ACTINIDE_FNS``, and ``ACTINIDE_BUILTINS`` are lists of - function objects. Each will be bound as if by the corresponding - ``session.bind_void``, ``session.bind_fn``, or ``session.bind_builtin`` - method. - -The ``actinide.builtin`` module contains a helper function, ``make_registry``, -which can simplify construction of these fields: +Finally, Actinide can bind specially-crafted Python modules. If a module +contains a top-level symbol named ``An`` (for the informal chemical symbol for +the actinide series), it can be passed to the session's ``bind_module`` method. +The symbol must be bound to an instance of the ``Registry`` class from the +``actinide.builtin`` module: .. code:: python - from actinide.builtin import make_registry - ACTINIDE_BINDINGS, ACTINIDE_VOIDS, ACTINIDE_FNS, ACTINIDE_BUILTINS, bind, void, fn, builtin = make_registry() + from actinide.builtin import Registry + An = Registry() - five = bind('five', 5) + five = An.bind('five', 5) - @void + @An.void def python_print(*args): print(*args) - @fn + @An.fn def bitwise_and(a, b): return a & b - @builtin + @An.builtin def two_values(): return 1, "Two" |
