3 ms·
First time I'm hearing about `named-let` and tail call optimisation in Emacs, thanks for sharing! A clarification: Tail call optimisation in Emacs is not tied
by hddqsb 4y ago
First time I'm hearing about `named-let` and tail call optimisation in Emacs, thanks for sharing!
A clarification: Tail call optimisation in Emacs is not tied specifically to `named-let`, but it is tied to `cl-labels` (which `named-let` uses internally). Normal functions declared using `defun` don't currently support tail call optimisation.
(The tail call optimisation was only added to `cl-labels` recently, in Emacs 28.1: https://github.com/emacs-mirror/emacs/commit/29c7f8c915c3889dfd5b25878aa0692f826cd38f https://github.com/emacs-mirror/emacs/commit/29c7f8c915c3889...)
- hddqsb 4y agoEdit: The documentation of `named-let`[1] explicitly mentions that it supports tail call optimisation, but the documentation of `cl-labels`[2] doesn't. So maybe the optimisation should be viewed as being tied specifically to `named-let` (or maybe the documentation of `cl-labels` should be updated to mention that it also supports the optimisation). [1]: https://www.gnu.org/software/emacs/manual/html_node/elisp/Local-Variables.html#index-named_002dlet https://www.gnu.org/software/emacs/manual/html_node/elisp/Lo... [2]: https://www.gnu.org/software/emacs/manual/html_mono/cl.html#index-cl_002dlabels https://www.gnu.org/software/emacs/manual/html_mono/cl.html#...