Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of modules in the stdlib should be sorted #740

Closed
talex5 opened this issue Jan 2, 2023 · 5 comments
Closed

List of modules in the stdlib should be sorted #740

talex5 opened this issue Jan 2, 2023 · 5 comments
Labels
bug Something isn't working v2

Comments

@talex5
Copy link

talex5 commented Jan 2, 2023

At the moment, https://v2.ocaml.org/releases/5.0/api/index.html seems to be in a random order. It starts:

  • Ocaml_operators
  • Format_tutorial
  • CamlinternalFormatBasics
  • Stdlib
  • Either
  • Sys
  • Obj
  • Atomic
  • ...

(@gasche reminded me of the importance of sorting in documentation in https://discuss.ocaml.org/t/dune-wish-list-for-2023/11083/26)

@gasche
Copy link
Member

gasche commented Jan 2, 2023

This list was sorted in the past, it looks like this is a regression that occurred for 4.13:

@cuihtlauac cuihtlauac added bug Something isn't working v2 labels Jan 2, 2023
@gasche
Copy link
Member

gasche commented Jan 2, 2023

@Octachron I can observe this issue in ocaml/ocaml upstream by:

make -C api_docgen clean
make html_doc -j
less ./api_docgen/ocamldoc/build/html/libref/index.html 

The following patch appears to fix the issue (at least in part):

diff --git a/api_docgen/Makefile.docfiles b/api_docgen/Makefile.docfiles
index 2d77fe6984..487bf304c7 100644
--- a/api_docgen/Makefile.docfiles
+++ b/api_docgen/Makefile.docfiles
@@ -76,8 +76,13 @@ compilerlibref=$(compilerlibref_MLIS:%.mli=%)
 compilerlibref_TEXT=Compiler_libs
 compilerlibref_C=$(call capitalize,$(compilerlibref))
 
-ALL_LIBREF= $(libref_TEXT:%=libref/%) $(libref:%=libref/%)
+ALL_LIBREF= $(call sort,$(libref_TEXT:%=libref/%) $(libref:%=libref/%))
 ALL_COMPILERLIBREF= \
   $(compilerlibref_TEXT:%=compilerlibref/%) \
   $(compilerlibref:%=compilerlibref/%)
 ALL_DOC= $(ALL_LIBREF) $(ALL_COMPILERLIBREF)

(I don't understand why this patch works, because sort is defined as ocamldep -sort which itself is documented as sorting by dependencies, while in practice it appears to sort alphabetically.)

(The patch keeps capitalized modules, namely Format_tutorial and OCaml_operators, at the front -- other modules come from uncapitalized module names so they get sorted after. I think this is an okay result, in any case we would rather have users read https://v2.ocaml.org/releases/5.0/manual/stdlib.html than the auto-generated https://v2.ocaml.org/releases/5.0/api/index.html.)

If you ( @Octachron ) can confirm that this is an upstream issue, we can move the discussion there.

@Octachron
Copy link
Member

This is almost certainly an issue on the compiler side (since the documentation at v2.ocaml.org is a direct copy of the documentation generated by the compiler).

@gasche
Copy link
Member

gasche commented Jan 3, 2023

The documentation generation issue was fixed upstream by @Octachron ( ocaml/ocaml#11860 ). I believe that he is planning to update the ocaml.org manual pages for 4.13, 4.14 and 5.0 -- once this is done we can close the present issue.

@tmattio
Copy link
Collaborator

tmattio commented Jan 6, 2023

Fixed by @Octachron in ocaml/v2.ocaml.org#1631

@tmattio tmattio closed this as completed Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v2
Projects
Archived in project
Development

No branches or pull requests

5 participants