documentation: precedence table for the standard library.#2117
documentation: precedence table for the standard library.#2117Octachron merged 12 commits intoocaml:trunkfrom
Conversation
|
This is a fine thing. It would be nice in theory if the texinfo stuff could be fixed, but I'll admit that even I use it so rarely that I probably wouldn't notice. |
|
Thanks! Do you have an HTML rendering of the new version? |
stdlib/stdlib.mli
Outdated
| The functions are called in 'last in, first out' order: the | ||
| function most recently added with [at_exit] is called first. *) | ||
|
|
||
| (** {1:precedence Appendix: precedence level and associativity of operators } |
There was a problem hiding this comment.
Maybe have an implementation comment here indicating to remember to update the other table (in the manual), and also the other way around?
There was a problem hiding this comment.
I added the two synchronization comments.
Built it, yes. I should mention I noticed a couple of oddities (the hyperlinks for |
|
It looks weird to have the list of submodules without transition, as if they were part of the appendix. I suppose it was already weird before the appendix was added. Can it be placed before, with a title/section name? Or should there at least be a section for it after the appendix? |
|
Good point. I moved the appendix to the end of the documentation and added a section for the list of modules of the standard library. |
gasche
left a comment
There was a problem hiding this comment.
I like the result. Given how easy it is to jump to the table, at least in the HTML version, I'm not completely sure that we really need to recall the levels in the text itself (we could just say (see the {!reference} for associativity and precedence)), but I'm content with the current state.
Except for associativity which concerns the operator itself and not its relationship to others, I would tend to agree with @gasche. I think precedence relationships among operators is better understood by the table than with the text and the idea of classifying by domain doesn't work that well since for example Also repeatedly seeing the whole table might help people (at least visual ones) to eventually get it in their brain (personally I'm a lost cause). |
|
I agree that the textual description of precedence is not really useful for the html version, I am less sure for the manpage version where it is not possible to follow the link to the table. |
One option is to have a man page specifically for precedence. Some man page readers (including the one I use in emacs) let you click from one man page to another when there are cross references. |
|
Indeed, it seems that lifting the table to its own page might be the more portable choice. |
|
I'm not sure what are valid manpage names, but one that comes to mind is |
|
Most Unix systems have an operator(7) man page with C operators and their precedence. An |
bd071b0 to
b8ed5af
Compare
|
I have split the operator table to its own documentation-only module
|
manual/manual/refman/expr.etex
Outdated
| operators and non-closed constructions. The constructions with higher | ||
| precedence come first. For infix and prefix symbols, we write | ||
| ``"*"\ldots'' to mean ``any symbol starting with "*"''. | ||
| % Note that this table is duplicated in stdlib/stdlib.mli, these tables should |
|
I don't remember everything; is the PR mergeable in the current state (modulo minor fix discussed above)? |
b8ed5af to
c951d3c
Compare
|
Some check-typo fiddling was missing, but this should be fixed in the last commit. |
|
Well then I would suggest that you merge when you are satisfied with the results / typo checks / CI results :-) (I already approved.) |
|
I will merge tomorrow to let some time for potential reaction. |
|
I have fixed some missing reference in the pdf manual, and some missing cleanup; I will merge once CIs pass. |
Following the disucssion in #1167, this PR proposes to add a copy of the manual's precedence table inside the standard library documentation page. This makes possible to link easily the description of each operators to this precedence table, replacing the quite arbitrary ordinal precedence level used before.
To add a bit more context, each operator is also linked to the representative of its precedence class and the representative of the 2-neareast precedence classes.
Unfortunately, ocamldoc does not support table by itself. Thus the table is implemented separately for the latex, html and manpage backends. Since the texinfo backend seems faulty for the standard library, I did not include a texinfo version of the table.
The last commit is a small fix that document the fact that
#...are left-associative in the manual .