Emacs Lisp的“从上至下执行”是可依赖的吗?

这里不讨论诸如lazy load等人为控制执行顺序的方法造成的影响。

我想问的是Emacs Lisp的“从上到下执行”这个机制是一定的吗?会不会即使我没有人为干扰也会发生变化?


I have read it. However, it is not suitable to use progn anywhere…

–Translated by Google Translate

So the body of a function was made into an implicit progn : several forms are allowed just as in the body of an actual progn . Many other control structures likewise contain an implicit progn.



The simplest order of execution is sequential execution: first form a, then form b, and so on. This is what happens when you write several forms in succession in the body of a function, or at top level in a file of Lisp code



1 个赞


Lisp 里只有 Scheme 开始允许有 unspecific evaluation order ,而且不是必须有,比如 chez 不保证从左到右,但 Racket 会遵守从左到右。原则上是为了方便编译器优化和鼓励减少使用副作用。

1 个赞