问题描述
这是示例界面test.mli
,并用ocamldoc样式的注释进行了注释:
Here is an example interface test.mli
, commented with ocamldoc-style comments:
(** ocamldoc module comment *)
open MissingModule;;
(** ocamldoc function comment *)
val test : unit;;
如果运行命令ocamldoc test.mli
,则会出现以下错误:
If I run the command ocamldoc test.mli
, I get the following error:
File "test.mli", line 2, characters 0-9:
Error: Unbound module MissingModule
1 error(s) encountered
为什么文档生成器应该关心未绑定的模块?
Why should a documentation generator care about unbound modules?
推荐答案
这是因为ocamldoc
完全限定了类型名称.文件:
That's because ocamldoc
fully qualifies type names. The file:
open MissingModule
val f: foo -> unit
被翻译为
val f: MissingModule.foo -> unit
MissingModule.foo
成为对MissingModule
中foo
定义的很好的交叉引用(如果missingModule.mli
作为ocamldoc
的参数给出).
And MissingModule.foo
becomes a nice cross-reference to the definition of foo
in MissingModule
(if missingModule.mli
is given as argument to ocamldoc
).
要完成答案,为了完全限定类型标识,您需要输入要处理的文件.因此,ocamldoc
需要能够访问相应的.cmi
文件.
And to complete the answer, in order to fully qualify type idents, you need to type the file you are processing. So ocamldoc
needs to be able to access to the corresponding .cmi
files.
这篇关于为什么ocamldoc在未绑定的模块上失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!