5

这是一个示例界面test.mli,带有 ocamldoc 样式的注释:

(** ocamldoc module comment *)
open MissingModule;;
(** ocamldoc function comment *)
val test : unit;;

如果我运行命令ocamldoc test.mli,我会收到以下错误:

File "test.mli", line 2, characters 0-9:
Error: Unbound module MissingModule
1 error(s) encountered

为什么文档生成器应该关心未绑定的模块?

4

1 回答 1

6

那是因为ocamldoc完全限定类型名称。文件:

open MissingModule

val f: foo -> unit

被翻译成

val f: MissingModule.foo -> unit

并成为对inMissingModule.foo定义的一个很好的交叉引用(如果作为参数给出)。fooMissingModulemissingModule.mliocamldoc

为了完成答案,为了完全限定类型标识,您需要键入您正在处理的文件。所以ocamldoc需要能够访问相应的.cmi文件。

于 2012-04-18T22:20:51.550 回答