Add documentation for -ppx#5
Add documentation for -ppx#5whitequark wants to merge 8 commits intoocaml:trunkfrom whitequark:trunk
Conversation
This style is missing even from Debian's texlive-latex-extra.
This commit properly runs local ocamldoc via an explicit ocamlrun invocation, as already done in manual/library/Makefile.
manual/library/compilerlibs.etex
Outdated
There was a problem hiding this comment.
I wonder to which extent it wouldn't be better to just show the ocamlfind way directly. Or, to respect the manual tradition to be self-contained and teach us the hard way, at least follow it with the ocamlfind commands people will actually use (and adapt in their build systems).
(This also has technical advantages: the widely-documented habit to use +camlp4 has become problematic now that camlp4 is split outside the distribution, so de-emphasizing the +foo feature seems reasonable to avoid such issues in the future.)
There was a problem hiding this comment.
I think I will show ocamlfind commands before the hard way ones.
manual/library/compilerlibs.etex
Outdated
There was a problem hiding this comment.
Documenting more modules is a mildly controversial change. I personally think it's a good idea, but maybe we should be modest in the amount of modules we document. Here is my understanding of the space, in decreasing order of (sujective) importance:
Ast_{helper,mapper}should clearly go inParsetreewould be a natural choice given the excellent documentation work Alain has done (why isparsetree.mliseemingly missing here?)Asttypes,LongidentandLocationare currently necessary to be construct ASTsParseandPprintastare not necessary for all uses of-ppx, but could be mildly useful for some hackish purposes- I think we don't need
LexerandPrintast
I think it would be reasonable to have (1,2,3) in, and maybe leave (4) aside for the moment -- we can always add more later.
There was a problem hiding this comment.
The problem with Ast_helper is that it's basically ~20 pages of undocumented function signatures. I'm not sure how I feel about adding it to the manual.
There was a problem hiding this comment.
Then maybe we could start slow and recommend that the interested people go read the .mli files directly. We could here just briefly describe the various files and their purpose, without including any generated HTML documentation.
There was a problem hiding this comment.
Actually, I disagree completely. Generated HTML documentation would be incredibly useful; you don't see these things unless you go through the link and it is immeasurably better than browsing .mli file in every way. I strongly prefer as much .mli files going into HTML as possible.
I'm only worried about pdf/text manuals here. So, I think it is a good idea to only include the better-documented parts into the pdf/text manual--with your points 1-3, it would be everything except Ast_helper.
There was a problem hiding this comment.
I'll ask around for opinions on this, but for now I'm fine with going with what you think is best.
I still don't see the point of exposing Lexer, which is ugly as hell.
There would be some (minor) work to do to improve pprintast.mli if/when it is exposed, putting the printer class at the end (most users don't need it) and briefly describing the purpose in a top comment. (Not saying you personally should do this.)
There was a problem hiding this comment.
I don't have many problems hiding Lexer (it is ugly as hell) and Printast (a better Printast is one made with [@@deriving show] :p) for now.
Pprintast is very useful for printing error messages, I have used it several times in my ppx extensions. Parse is useful for things like interactive toplevels and such. I think it should be present for completeness.
There was a problem hiding this comment.
I think we agree (I looked at Printast and its interface is so simple and clean that I have no issue with including it; I expect most people to use -dparsetree directly, though).
|
Maybe |
|
The HTML file is currently called |
|
Regarding the inclusion of large HTML documents, why not add them to ocaml.org. Since these are part of official releases, we could put them under URLs like |
|
@agarwal HTML document size is not an issue at all. I was only concerned that the PDF was growing by ~20 pages in size without much benefit. |
|
@gasche I've updated the PR according to your feedback. |
|
@whitequark Right, I also meant size in the sense of bloating the manual. The manual should have the same contents whether in HTML or PDF format. Thus, if you don't want to bloat the PDF version, which I agree you shouldn't, then I don't think the extra pages should be in the HTML version either. Then the question is where to put the pages, and I thought ocaml.org would be a good choice. Anyway, just my 2 cents. |
|
@agarwal I expect that PDF and HTML versions will be used differently. If you insist that the versions should be kept coherent, then I think we should bite the bullet and include Ast_helper in PDF manual. Putting the documentation in several separate places is too fragile, not to mention it will then not be available offline, potential link breakage, and so on. |
I don't insist, but it does seem odd to me. |
|
@agarwal I just can't easily imagine someone using the PDF manual to look up function signatures. Howver this is something I do with HTML manual often. If you think this would be something the readers want, we should include Ast_helper. |
There was a problem hiding this comment.
I feel like you should give a sort of "reading order" (Ast_mapper first, for ppxs basic blocs, then Parsetree to see what the AST look like, then Ast_helper, to actually build pieces of asts).
There was a problem hiding this comment.
This section is not solely about -ppx rewriters, and the documentation for -ppx option refers to Ast_mapper directly.
|
I'm rather satisfied with the result. |
I doubt they would. |
|
Merged in the manual. There is a dangling reference problem in cmds.etex (HTML rendering only) that is still to be fixed. |
One thing that I'm not sure of is whether to include documentation for Ast_helper and most of its siblings in the pdf (also text &c) manual. Ast_helper alone takes twenty pages. This is not a problem for HTML manual.
I frequently look up signatures in the HTML manual, so it's useful even if it's not documented. However I'm not sure if that is the case with linear manuals.