asdf:load-system时,系统名称是否必须与文件名相同?

时间:2013-11-15 04:07:31

标签: lisp common-lisp sbcl asdf

我正在学习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-system,它直接工作。

我非常困惑,我在ASDF手册中找不到这两个名字应该相同的线索吗?

有人可以给我一些见解吗?

谢谢,

1 个答案:

答案 0 :(得分:3)

我发现了这个线索:“注意系统的名称被指定为字符串或符号,通常是关键字。如果是符号(包括关键字),则其名称是小写的。名称必须是一个合适的值:name initarg to make-pathname在任何文件系统中找到系统。

http://common-lisp.net/project/asdf/asdf/Using-ASDF.html

消息是(asdf:defsystem <symbol> ...)表单应驻留在名为<lowercased-symbol>.asd的文件中。如果使用字符串命名系统,则文件名应使用该字符串。