0

我目前正在使用 LispWorks,我想设置 REPL,以便只需键入对应的数字即可退出调试器(abort) Return to top loop level 0,就像使用 SBCL 一样。

通常,使用 LispWorks 需要键入:c + [abort option number].

看一个简单的例子,使用 LispWorks:

CL-USER 1 > a

Error: The variable A is unbound.
  1 (continue) Try evaluating A again.
  2 Return the value of :A instead.
  3 Specify a value to use this time instead of evaluating A.
  4 Specify a value to set A to.
  5 (abort) Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 2 : 1 > :c 5

CL-USER 3 >

使用 SBCL 时,只要数字就足够了:

* a

debugger invoked on a UNBOUND-VARIABLE in thread
#<THREAD "main thread" RUNNING {10012E0613}>:
  The variable A is unbound.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE   ] Retry using A.
  1: [USE-VALUE  ] Use specified value.
  2: [STORE-VALUE] Set specified value and use it.
  3: [ABORT      ] Exit debugger, returning to top level.

(SB-INT:SIMPLE-EVAL-IN-LEXENV A #<NULL-LEXENV>)
0] 3

*

REPL 调试器命令文档似乎没有列出这种可能性。

如果可能的话,如何退出 LispWorks REPL 调试器,返回到顶层,只输入一个数字,就像使用 SBCL 一样?

4

2 回答 2

3

基本上你不能。它也更加一致:

* a

debugger invoked on a UNBOUND-VARIABLE in thread
#<THREAD "main thread" RUNNING {10005004F3}>:
  The variable A is unbound.

    Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

    restarts (invokable by number or by possibly-abbreviated name):
      0: [CONTINUE   ] Retry using A.
      1: [USE-VALUE  ] Use specified value.
      2: [STORE-VALUE] Set specified value and use it.
      3: [ABORT      ] Exit debugger, returning to top level.

    (SB-INT:SIMPLE-EVAL-IN-LEXENV A #<NULL-LEXENV>)
    0] 4

    4
    0] 3
    * 

在上面的 SBCL 示例中,数字 0...3 选择了该调试器选项,而所有其他数字都评估......这有点奇怪。

LispWorks:调试器中的简单中止

在 LispWorks 中,如果您想使用abort重新启动,请使用:a

CL-USER 1 > a

Error: The variable A is unbound.
  1 (continue) Try evaluating A again.
  2 Return the value of :A instead.
  3 Specify a value to use this time instead of evaluating A.
  4 Specify a value to set A to.
  5 (abort) Return to level 0.
  6 Return to top-level loop.
  7 Return from multiprocessing.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 2 : 1 > :a

CL-USER 3 > 

LispWorks 环境中还有一个meta-shift-a键盘命令可以在调试器中中止。此外,重新启动可在菜单和右键单击上下文菜单中使用。也可以使用监听器/调试器/...图标栏中的中止图标

优点:您不必记住重新启动的次数,因为这可能因错误而异。

于 2019-07-03T10:26:41.877 回答
0

当发生错误时,您在 LispWorks 的 REPL 中看到的内容是由错误函数生成的,由 Lispworks 实现。要更改处理选项的方式,您必须修改该函数,因为它以特定方式与 LispWorks 的 REPL 交互,因此您没有文档。所以,简而言之,你不能。(顺便说一句, :c 中的“c”代表“继续”。)

于 2019-07-03T10:05:45.143 回答