Why is there no tail recursion optimization in Emacs lisp, and not like another scheme?

Emacs lisp is a dialect of lisp and especially a circuit. Most schema interpreters have Tail Recursion optimizations, but emacs lisp doens't. I searched for a reason in `info elisp 'for a while, but I could not find it.

PS Yes, elisp has a different iteration syntax of the `while 'type, but I still cannot find a good reason why they did not implement tail recursion like other schema interpreters.

+4
source share
3 answers

Emacs Lisp was created in the 1980s. The Lisp dialog that Emacs (Richard Stallman) was most familiar with at that time was MIT Maclisp, and Emacs Lisp is very similar to it. He used dynamic change of variables and did not have lexical closures or tail recursion optimization, and Emacs Lisp is the same.

Emacs Lisp is very different from Schema. The biggest difference is that Scheme is lexically limited, but it was recently added to Emacs Lisp and needs to be included for each file (by placing it ;;; -*- lexical-binding: t -*-on the first line), because doing this by default can cause a lot of incompatibilities.

There was some work on replacing Emacs Lisp with Guile, Schema dialogs. But it is not clear whether he will succeed.

+9
source

Emacs Lisp / 25 . , , Emacs-24 ( ), .

ELisp , , . , ELisp, , .

+5

It looks like someone made an implementation of TCO in Emacs Lisp: https://github.com/Wilfred/tco.el . I did not play with him myself, but you might want to give him a whirlwind if you are interested in seeing TCO in Emacs Lisp.

+3
source

Source: https://habr.com/ru/post/1648596/


All Articles