xie*_*pan 3 sbcl common-lisp asdf
我在脚本文件中使用ASDFload 。cl-ppcre问题是(progn (require :asdf) (require :cl-ppcre))在顶层完全没问题,但如果将相同的代码包装在 a 中handler-case,system-out-of-date则会捕获一个条件handler-case,并且整个评估停止,并且不会加载所需的包。我只是确认 REPL 中也发生了同样的问题。无论我尝试加载哪个库,同样的问题都会发生在handler-case. 以下是完整的会话:
; 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/")
Run Code Online (Sandbox Code Playgroud)
根据 ASDF 手册,我将库放入~/common-lisp directory,并且库已经编译并保存在~/.cache/common-lisp directory.
对 ASDF 发生的事情有什么了解吗?
如果您要求handler-case捕获任何发出信号的条件(就像您所做的那样),无论该条件是否是错误,它都会执行此操作。 你几乎永远不想这样做。
特别是如果你查看plan.lispASDF来源,你会发现
;; 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)
...)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
95 次 |
| 最近记录: |