gpt4 book ai didi

lisp - GCL中的条件如何处理?

转载 作者:行者123 更新时间:2023-12-04 00:48:59 25 4
gpt4 key购买 nike

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
为了反射(reflect)更改,启动消息的第一行从以下位置更改:
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

关于lisp - GCL中的条件如何处理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68206447/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com