Slime 抛出“可变绑定深度超过 max-specpdl-size”在我的 Clojure repl 中
我的 clojure repl 开始抛出“变量绑定深度超过 max-specpdl-size”错误,并且我被扔进了调试器。
我目前正在通过 clojure-jack-in 访问 slime,并且正在对合理大小的数据集执行缩减操作。一些谷歌搜索让我相信这个错误是因为我生成了太多临时变量,具体来说:
用户选项:max-specpdl-size
此变量定义了在 Emacs 发出错误信号(带有数据“变量绑定深度超过 max-specpdl-size”)之前允许的本地变量绑定总数和展开保护清理(请参阅从非本地退出清理)的限制。 ”)。
这个限制以及超出时的相关错误是 Lisp 避免在定义不明确的函数上无限递归的一种方法。 max-lisp-eval-depth 提供了对嵌套深度的另一个限制。请参阅评估。
默认值为 1000。如果剩余空间很小,进入 Lisp 调试器会增加该值,以确保调试器本身有执行空间。 在这里找到。
我对调试 clojure-swank/slime 缺乏经验,所以我希望有人可以提供帮助。
编辑: 我将 clojure-mode 1.11.4 与 emacs 24 和 clojure 1.3.0 一起使用,我没有安装 swank-clojure,我使用的是通过 clojure-jack-in 与 clojure-mode 捆绑在一起的版本,正如我所解释的那样早些时候。
My clojure repl started throwing a "Variable binding depth exceeds max-specpdl-size" error and I've gotten thrown into the debugger.
I am currently accessing slime via clojure-jack-in and I am executing a reduce on a reasonable sized dataset. A bit of googling leads me to believe that the error is because I'm generating too many temporary variables, specifically:
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.
I have little experience with debugging clojure-swank/slime so I hope someone can help.
EDIT:
I'm using clojure-mode 1.11.4 with emacs 24 and clojure 1.3.0, I've not installed swank-clojure, I'm using the one that comes bundled with clojure-mode via clojure-jack-in as I explained earlier.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以防万一有人正在寻找这个问题的可能答案......
正如概述的那样,这个错误通常意味着一个问题,但并非总是如此。在拥有大型数据结构或使用某些 emacs 功能(例如 defadvice)的情况下,您可以合法地超出默认深度设置,这可能会导致深度绑定等。您可以增加深度,看看这是否有帮助(例如,加倍),但在这种情况下它可能是一个错误。
swank-clojure 的问题之一是它与旧版本的 slime 紧密耦合。这意味着史莱姆中的改进和错误修复不可用。正是由于这种紧密的结合,coljure 社区已经从使用 slime 转向使用 cider,我强烈建议改用 cider,而不是 slime 和 swank-clojure。
Just in case someone is looking for a possible answer to this questions....
This error, as outlined, does often mean a problem, but not always. You can legitimately exceed the default depth setting in situations where you have large data structures or where you are usiing some emacs features, such as defadvice, which can result in deep bindings etc. You can increase the depth and see if that helps (for example, double it), but in this case it probably is an error.
One of the problems with swank-clojure is that it is tightly coupled with an old version of slime. This means improvements and bug fixes in slime are not available. It is because of this tight binding that the coljure community has moved away from using slime to using cider and I'd strongly recommend switching to using cider rather than slime and swank-clojure.