diff --git a/NEWS.rst b/NEWS.rst index 5cc85edd3..37e30ea33 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -18,6 +18,10 @@ Bug Fixes * `let` should no longer re-evaluate default arguments. * Improved error messages for illegal uses of `finally` and `else`. +New Features +------------------------------ +* the attribute access macro `.` now accepts method calls. + 1.0a3 (released 2021-07-09) ============================== diff --git a/docs/api.rst b/docs/api.rst index 036c672ee..f6c8469cc 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -88,19 +88,19 @@ base names, such that ``hy.core.macros.foo`` can be called as just ``foo``. :: - (. foo bar baz [(+ 1 2)] frob) + (. foo (bar "qux") baz [(+ 1 2)] frob) Compiles down to: .. code-block:: python - foo.bar.baz[1 + 2].frob + foo.bar("qux").baz[1 + 2].frob ``.`` compiles its first argument (in the example, *foo*) as the object on which to do the attribute dereference. It uses bare symbols as attributes - to access (in the example, *bar*, *baz*, *frob*), and compiles the contents - of lists (in the example, ``[(+ 1 2)]``) for indexation. Other arguments - raise a compilation error. + to access (in the example, *baz*, *frob*), Expressions as method calls (as in *bar*), + and compiles the contents of lists (in the example, ``[(+ 1 2)]``) for indexation. + Other arguments raise a compilation error. Access to unknown attributes raises an :exc:`AttributeError`. Access to unknown keys raises an :exc:`IndexError` (on lists and tuples) or a