0

I'm using SLIME and EMACS for Common LISP, with the SBCL compiler. The autodoc feature of SLIME, where function arguments are shown in the minibuffer, works fine.

But when I execute a custom REPL like the following:

(defun game-repl ()
  (let ((cmd (game-read)))
    (unless (eq (car cmd) 'quit)
      (game-print (game-eval cmd))
      (game-repl))))

The autodoc feature doesn't work anymore. Not in LISP buffers, and not in my custom REPL. Probably because the SBCL process is busy with my REPL (waiting for input) and can't communicate with SLIME.

After I start another SBCL process with C-u M-x slime, the autodoc feature works again, but only in LISP buffers.

So, is there a way to get the SLIME autodoc in my custom REPL?

4

1 回答 1

2

我认为您得出的结论是正确的后端(在您的 sbcl 进程中)很忙。IIRC slime 具有同步和异步命令,您game-repl将是一个同步命令,不允许异步文档命令通过后端 - 相反,在 slime REPL 中编写常规命令时,后端是空闲的,所以文档查询可以通过。

但请原谅我还想知道您在这种特殊情况下所做的事情是否有意义——自定义 REPL 的目的可能是以下之一或两者:

  • 公开有限的或合成的命令集
  • 提供非标准的控制/语法结构

在任何一种情况下,自定义 REPL 的输入都可能不等同于 slime 可以为您自动生成的常规代码。

一个选项可能是提供一个有限的“游戏”命名空间,您可以在其中玩常规的 slime REPL,然后还提供一个单独的面向生产的 REPL,其阅读器只允许访问该命名空间中的符号?(这里有关于 common-lisp 沙盒的讨论。)

于 2011-11-11T11:13:30.160 回答