我正在学习ASDF,但是在加载定义的系统时遇到了奇怪的问题这里有一些信息。
我用一行内容定义了一个名为“hello.asd”的.asd文件:
(asdf:defsystem :hellosystem)
我把这个文件放到一个名为“/tmp/pkg”的目录中之后,我运行SBCL并尝试加载它输出如下:
This is SBCL 1.1.12, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (asdf:asdf-version)
"3.0.2"
* (push #P"/tmp/pkg/" asdf:*central-registry*)
(#P"/tmp/pkg/" #P"/Users/wuli2/quicklisp/quicklisp/")
* (asdf:load-system :hellosystem)
debugger invoked on a ASDF/FIND-SYSTEM:MISSING-COMPONENT:
Component :HELLOSYSTEM not found
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
((:METHOD ASDF/OPERATE:OPERATE (SYMBOL T)) ASDF/LISP-ACTION:LOAD-OP :HELLOSYSTEM) [fast-method]
0] 0
* (asdf:load-system :hello)
debugger invoked on a ASDF/FIND-SYSTEM:MISSING-COMPONENT:
Component :HELLO not found
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
((:METHOD ASDF/OPERATE:OPERATE (SYMBOL T)) ASDF/LISP-ACTION:LOAD-OP :HELLO) [fast-method]
0] 0
* (asdf:load-system :hellosystem)
T
*
请注意,我第一次尝试加载系统:hellosystem,它失败了所以我加载了系统:你好,我说也许它需要一个文件名,它又失败了当我偶尔运行加载系统时,奇怪的事情发生了:再次运行hellosystem,它成功了。
所以我做了另一个测试,更改文件名,使其与系统名相同然后运行asdf:load系统,它直接工作。
这让我很困惑,我在asdf手册中找不到两个名字应该相同的线索?
有人能告诉我一些情况吗?
谢谢,
吴
最佳答案
我发现了这条线索:“注意,系统的名称被指定为字符串或符号,通常是关键字如果一个符号(包括一个关键字),其名称将被采用并小写名称必须是一个合适的值:name initarg才能在要找到系统的任何文件系统中创建路径名。”
http://common-lisp.net/project/asdf/asdf/Using-ASDF.html
消息是(asdf:defsystem <symbol> ...)
表单应该位于名为<lowercased-symbol>.asd
的文件中如果使用字符串命名系统,则文件名应使用该字符串。
关于lisp - 执行asdf:load-system时,系统名称是否必须与文件名相同?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19993353/