gpt4 book ai didi

lisp - asdf :load-system? 系统名是否必须与文件名一致

转载 作者:太空宇宙 更新时间:2023-11-03 18:52:47 24 4
gpt4 key购买 nike

我正在学习 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 时失败了。所以我加载了系统 :hello,我猜测它可能需要一个文件名,但它又失败了。当我偶尔再次运行 load system :hellosystem 时,奇怪的事情发生了,它起作用了。

所以我又做了一个测试,把文件名改成和系统名一样。然后运行asdf:load-system,直接运行。

这让我很困惑,我在 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/

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