gpt4 book ai didi

common-lisp - ASDF 抛出系统过时条件

转载 作者:行者123 更新时间:2023-12-05 01:51:19 24 4
gpt4 key购买 nike

我正在使用 ASDF加载 cl-ppcre在脚本文件中。问题是 (progn (require :asdf) (require :cl-ppcre))在顶层完全没问题,但如果相同的代码包含在 handler-case 中, 一个 system-out-of-date条件将被 handler-case 捕获并且整个评估停止,并且不会加载所需的包。我只是确认同样的问题也发生在 REPL 中。无论我尝试加载什么库,同样的问题只会发生在 handler-case 中。 .以下是完整的 session :

; SLIME 2.27
CL-USER> (require :asdf)
NIL
CL-USER> (find-package :cl-ppcre)
NIL
CL-USER> (handler-case (require :cl-ppcre) (t (c) (format t "~a: ~a~%" (type-of c) c)))
SYSTEM-OUT-OF-DATE: system cl-ppcre is out of date
NIL
CL-USER> (find-package :cl-ppcre)
NIL
CL-USER> (require :cl-ppcre)
NIL
CL-USER> (find-package :cl-ppcre)
#<PACKAGE "CL-PPCRE">
CL-USER> (handler-case (require :cl-ppcre) (t (c) (format t "~a: ~a~%" (type-of c) c)))
NIL
CL-USER> (list (lisp-implementation-type) (lisp-implementation-version))
("SBCL" "2.2.4")
CL-USER> (asdf:asdf-version)
"3.3.1"
CL-USER> (directory "/home/pxie/common-lisp/*" :resolve-symlinks nil)
(#P"/home/pxie/common-lisp/alexandria/" #P"/home/pxie/common-lisp/cl-ppcre/")

根据 ASDF 手册,我将我的库放在 ~/common-lisp directory 中,以及已经编译并保存在 ~/.cache/common-lisp directory 中的库.

对 ASDF 中正在发生的事情有任何见解吗?

最佳答案

如果您要求 handler-case 捕获发出信号的任何条件,就像您所做的那样,无论该条件是否为错误,它都会执行此操作。 您几乎不想这样做。

特别是如果您查看 the ASDF sources 中的 plan.lisp你会发现

  ;; NB: This is not an error, not a warning, but a normal expected condition,
;; to be to signaled by FIND-SYSTEM when it detects an out-of-date system,
;; *before* it tries to replace it with a new definition.
(define-condition system-out-of-date (condition)
...)

关于common-lisp - ASDF 抛出系统过时条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72334900/

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