GCL 中如何处理条件?
How can conditions be handled in GCL?
handler-case
是 Common Lisp 中处理条件的关键,但 Ubuntu 18.04 上的 GCL 2.6.12 认为它是一个未定义的函数:
>(handler-case (error "test") (error (condition) condition))
Error: UNDEFINED-FUNCTION :NAME HANDLER-CASE
Fast links are on: do (si::use-fast-links nil) for debugging
Signalled by EVAL.
UNDEFINED-FUNCTION :NAME HANDLER-CASE
Broken at EVAL. Type :H for Help.
1 Return to top level.
>>
handler-bind
也是如此。
GCL 手册中与处理条件或错误相关的唯一函数是特定于 GCL 的 universal-error-handler
。
如何在 GCL 中处理条件,最好是以其他 Lisp 支持的方式?
项目的README.Debian
中说明了情况:
[...] The common lisp standard in effect when GCL was first released is known as "Common Lisp, the Language" (CLtL1) after a book by Steele of the same name providing this specification. Subsequently, a much expanded standard was adopted by the American National Standards Institute (ANSI), which is still considered the definitive common lisp language specification to this day.
[...]
To toggle the use of the ANSI image, set the environment variable GCL_ANSI to any non-empty string.
(This Debian bug 有更多信息。)
handler-case
需要 ANSI 支持,所以在基于 Debian 的系统上,GCL 需要使用 GCL_ANSI
环境变量集启动;例如:
$ GCL_ANSI=1 gcl
为反映更改,启动消息的第一行更改为:
GCL (GNU Common Lisp) 2.6.12 CLtL1 Fri Apr 22 15:51:11 UTC 2016
收件人:
GCL (GNU Common Lisp) 2.6.12 ANSI Fri Apr 22 15:51:11 UTC 2016
handler-case
是 Common Lisp 中处理条件的关键,但 Ubuntu 18.04 上的 GCL 2.6.12 认为它是一个未定义的函数:
>(handler-case (error "test") (error (condition) condition))
Error: UNDEFINED-FUNCTION :NAME HANDLER-CASE
Fast links are on: do (si::use-fast-links nil) for debugging
Signalled by EVAL.
UNDEFINED-FUNCTION :NAME HANDLER-CASE
Broken at EVAL. Type :H for Help.
1 Return to top level.
>>
handler-bind
也是如此。
GCL 手册中与处理条件或错误相关的唯一函数是特定于 GCL 的 universal-error-handler
。
如何在 GCL 中处理条件,最好是以其他 Lisp 支持的方式?
项目的README.Debian
中说明了情况:
[...] The common lisp standard in effect when GCL was first released is known as "Common Lisp, the Language" (CLtL1) after a book by Steele of the same name providing this specification. Subsequently, a much expanded standard was adopted by the American National Standards Institute (ANSI), which is still considered the definitive common lisp language specification to this day.
[...]
To toggle the use of the ANSI image, set the environment variable GCL_ANSI to any non-empty string.
(This Debian bug 有更多信息。)
handler-case
需要 ANSI 支持,所以在基于 Debian 的系统上,GCL 需要使用 GCL_ANSI
环境变量集启动;例如:
$ GCL_ANSI=1 gcl
为反映更改,启动消息的第一行更改为:
GCL (GNU Common Lisp) 2.6.12 CLtL1 Fri Apr 22 15:51:11 UTC 2016
收件人:
GCL (GNU Common Lisp) 2.6.12 ANSI Fri Apr 22 15:51:11 UTC 2016