我的 clojure repl 开始抛出“变量绑定(bind)深度超过 max-specpdl-size”错误,我被扔进了调试器。
我目前正在通过 clojure-jack-in 访问 slime,并且正在对一个合理大小的数据集执行 reduce。一些谷歌搜索让我相信这个错误是因为我生成了太多的临时变量,具体来说:
User Option: max-specpdl-size
This variable defines the limit on the total number of local variable bindings and unwind-protect cleanups (see Cleaning Up from Nonlocal Exits) that are allowed before Emacs signals an error (with data "Variable binding depth exceeds max-specpdl-size").
This limit, with the associated error when it is exceeded, is one way that Lisp avoids infinite recursion on an ill-defined function. max-lisp-eval-depth provides another limit on depth of nesting. See Eval.
The default value is 1000. Entry to the Lisp debugger increases the value, if there is little room left, to make sure the debugger itself has room to execute. found here.
我对调试 clojure-swank/slime 的经验很少,所以我希望有人能提供帮助。
编辑: 我将 clojure-mode 1.11.4 与 emacs 24 和 clojure 1.3.0 一起使用,我没有安装 swank-clojure,我使用的是通过 clojure-jack-in 与 clojure-mode 捆绑在一起的那个,正如我所解释的早些。
最佳答案
以防万一有人正在寻找这个问题的可能答案....
如前所述,此错误通常意味着存在问题,但并非总是如此。在具有大型数据结构或使用某些 emacs 功能(例如 defadvice,这可能导致深度绑定(bind)等)的情况下,您可以合法地超过默认深度设置。您可以增加深度并查看是否有帮助(例如, 加倍), 但在这种情况下它可能是一个错误。
swank-clojure 的一个问题是它与旧版本的 slime 紧密耦合。这意味着粘液中的改进和错误修复不可用。正是由于这种紧密绑定(bind),coljure 社区已经从使用 slime 转向使用 cider,我强烈建议改用 cider 而不是 slime 和 swank-clojure。
关于emacs - Slime 在我的 Clojure repl 中抛出 "Variable binding depth exceeds max-specpdl-size",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8500803/