Why does ocamldoc fail on unbound modules?

折月煮酒 提交于 2019-12-10 14:32:37

问题


Here is an example interface test.mli, commented with ocamldoc-style comments:

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

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?


回答1:


That's because ocamldoc fully qualifies type names. The file:

open MissingModule

val f: foo -> unit

is translated to

val f: MissingModule.foo -> unit

And MissingModule.foo becomes a nice cross-reference to the definition of foo in MissingModule (if missingModule.mli is given as argument to ocamldoc).

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.



来源:https://stackoverflow.com/questions/10217840/why-does-ocamldoc-fail-on-unbound-modules

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!