install *ml and *mli files for compiler-libs too#827
install *ml and *mli files for compiler-libs too#827damiendoligez merged 1 commit intoocaml:trunkfrom
Conversation
|
Partly solves MPR7362. |
|
I think (but I have not discussed this recently) that the reluctance to expose interface and implementations of the I would personally agree that even the interfaces that are not meant for wide use and that are unstable could and should be documented. However, there is also a real concern with lack of clear information of what should be considered external/stable and internal/unstable. Finding ways to address this concern could be a useful way to push the proposed changes further. For example, maybe it would be a good first step to add to the |
|
@gasche I have no opinion whether the |
|
I understand your request from the point of view of the tool, I was pointing out that there were clear social reasons why the stdlib files and the compiler-libs files are handled differently, this is not merely a matter of an unexplained and unjustified inconsistency. |
|
I believe that one needs the mli and the ml files of compiler-libs if one really wants to program against this library. Currently users need to download the OCaml sources separately because neither opam nor debian install the those files. The OCaml reference manual clearly says "the exported front-end interface [...] does not provide any backwards compatibility guarantees." From my point of view, this warning is completely sufficient. For moving forward, it would be nice to find somebody who is able and willing to decide about what needs to be done to merge this pull request. @gasche could you do this? I can put a comment (** This interface follows the evolution of the OCaml language and implementation and is likely to change in the future. There is no guarantee about compatibility with future releases. *) into those files referenced from the OCaml manual, and a comment (** This is an OCaml internal interface that is likely to change in the future. Usage is discouraged. *) into all other files. But before doing so I would like to reach an agreement about these comments and the the other conditions for this pull request. |
I can see why this applies to the |
The ml files are installed for many libraries, see for instance the stdlib or lablgtk2. The real reason is that the documentation in the mli files is not sufficient. It is, for instance, necessary to call Location.init before Parse.implementation. You can find out about this however only by looking at the sources. The ml files only add 4.5MB on top of 70MB of the compiled modules and 1.2 MB of the mli files. |
|
@hendriktews I think this is actually intentional. This said, as you point out, this situation is not ideal when one wants to use tools to browse the sources. I already had this problem a long time ago when I wrote ocamlbrowser, and used it for the compiler itself. We could maybe add an extra target to install those files, but just for developers who need them. For others I'm afraid this would send the wrong message. |
I would expect either @damiendoligez or @xavierleroy to have strong opinions on this. |
|
It would be nice to have the .ml files for otherlibs installed too, if that could be considered at the same time. |
|
With upcoming OPAM 2.0 (compilers as packages), downloading the sources of the compiler is as simple as: and you will find an archive |
|
The "downloading the source is hard" argument was always weak, but I find @dbuenzli's remark compelling: whenever we install the I'm much less enthusiastic about installing the |
|
I don't think we should expose direct sources ( |
|
I admit my use-case is obscure. I have a program which uses compiler-libs to directly interpret the OCaml AST. Now, this is fine on any computer with OCaml installed, because |
From an If I can make MPR7362 more precise from a
|
|
My 2 cents: I don't buy the arguments that compiler-libs should somehow remains "hidden". It is widely used and is required for a lot of nice and important tools which could not be maintained outside the core distribution otherwise. The lack of API stability guarantee or nice upfront design should not be an excuse to avoid documenting it (and polish it). (Some parts of compiler-libs are actually not too badly documented, such as Parsetree, Ast_mapper, Ast_iterator.) I've nothing against adding more disclaimers, perhaps even in each .mli, about the lack of stability guarantee (and why not some call for helping with improving the doc?). As for which files to install: I've no strong opinion on it; personally, I'm perfectly fine browsing .mli files from upstream source packages but for easier accessibility, it is rather clear that the current situation is quite bad on the documentation front: no decent way to get cross-referenced documentation for all installed packages. This is an important topic and I'd be tempted to follow the suggestions of people putting efforts into improving this situation (i.e. @dbuenzli). If the community ever produces a better tool than ocamldoc and settles on it, one might always revert later and stop installing .mli files if .cmti are enough to get good documentation, which is not the case today. |
|
For the record, I fully agree with Alain's position above. @johnwhitington I don't think that there is any issue with treating |
|
My motivation for this pull request is not that downloading the sources is hard. That has never been hard and the upcoming "opam source" does not really make it simpler IMHO. The motivation is convenience: For many library functions, when I type their name, the declaration and the documentation in the mli file are a key stroke away. If that leaves any question open or if I am just curious, I can look at the sources with another key stroke. I have not yet seen a convincing argument why this should be different for compiler-libs. compiler-libs is described in the OCaml manual, there are many tools using it already. Many module interfaces are contained in the documentation in a hidden way (eg, Ast_invariants, Clflags, Identifiable). I don't think that installing the mli or ml files would encourage anybody to do anything on top of what they planed already. Anyway, I believe the discussion is far too long already for such a simple change. As I wrote before, I am happy to add the disclaimers. I am also happy to create a different install target for compiler-libs and/or the mli and/or the ml files. |
|
Have you ever tried If we install the sources for the compiler for convenience, then we should do it for all contributed libraries for exactly the same reason. Every OCaml switch is already big (between 200 MB to 1 GB), which makes having a lot of them become very space consuming: a good OCaml dev should make his contributions work on as many OCaml versions as possible, which means having at least all versions since 3.12.1 installed... What will happen if we double the space requirement by adding sources, just for convenience ? I think a better approach would be for you to create an OPAM package |
That's a pretty specific use case and I don't think it justifies installing the @hendriktews here's my recommendation: install |
|
@damiendoligez OK - and the mli files of compiler-libs go into the default installation target? |
Yes, that makes sense. |
029f21a to
1254cc8
Compare
|
I updated this PR, taking the comments into account. By default it installs the missing mli, cmti and cmt files. To get some of these cmti files, I added option -bin-annot for ocamldoc and tools. There is an additional target for installing compiler-libs ml sources. In detail: I looked a bit more systematically for missing cmti files and saw that apart from otherlibs, also
are missing. I am quite sure that we want to install odoc_info.cmti but for the others I don't really know. If these files were deliberately omitted, please tell and I'll revert. By default, this PR additionally installs
The make target install-compiler-sources installs the ml files for compiler-libs. @dbuenzli please check if this fixes MPR7362 completely. @damiendoligez Please check. |
If opam has a problem or if the way opam is used creates problems, then the people concerned about this should fix this in opam. But these opam problems should neither have a negative impact on people not using opam (and I believe there are quite a lot) nor stop us from taking the right decisions here.
Please argue with facts instead of dubious guesses. This PR adds 1.2MB of mli files and 4.5MB of ml files for the install-compiler-sources target. This is an increase of 0.6% and, respectively, 2.3% for the install-compiler-sources target. I really cannot see any point for creating fear about doubling space requirements.
IMHO, the solution would be that the opam maintainers create opam compiler packages that only install the essential stuff for those people that want to install all available OCaml versions in parallel. |
I don't think that's a problem specific to OPAM, system package manager might also want to have lean installs.
I guess so, though I don't know if maybe too much Regarding |
|
The "apart from otherlibs" files seem perfectly fine to me, I'm quite sure if they were omitted it was by mistake (and in fact Topdirs is interesting to people playing to the toplevel). |
Makefile
Outdated
| if test -f ocamlopt; then $(MAKE) installopt-compiler-sources; fi | ||
|
|
||
| # Installation of the *.ml sources native-code part of compiler-libs | ||
| installopt-compiler-sources: |
There was a problem hiding this comment.
Why not merge these two targets ? If somebody wants access to the compiler sources, he probably wants access to both bytecode and native code compilers.
There was a problem hiding this comment.
I agree with @lefessan. Just install all compiler sources unconditionally.
|
The forthcoming gdb support for OCaml needs both |
|
@mshinwell It would be nice if you could make a summary on the platform mailing list about what you think packages should install by default (compilation flags and build artefacts). The issue has been raised more than once without being conclusive. For most |
damiendoligez
left a comment
There was a problem hiding this comment.
Looks good to me, apart from the two notes I added.
Makefile
Outdated
| $(INSTALL_COMPLIBDIR) | ||
| cp expunge $(INSTALL_LIBDIR)/expunge$(EXE) | ||
| cp toplevel/topdirs.cmi $(INSTALL_LIBDIR) | ||
| cp toplevel/topdirs.cmi toplevel/topdirs.cmti toplevel/topdirs.mli \ |
There was a problem hiding this comment.
Please add toplevel/topdirs.cmt too.
Makefile
Outdated
| if test -f ocamlopt; then $(MAKE) installopt-compiler-sources; fi | ||
|
|
||
| # Installation of the *.ml sources native-code part of compiler-libs | ||
| installopt-compiler-sources: |
There was a problem hiding this comment.
I agree with @lefessan. Just install all compiler sources unconditionally.
- install missing mli and cmti files for compiler-libs and otherlibs - new make target install-compiler-sources to install compiler-libs ml files
1254cc8 to
fcf91f2
Compare
|
@damiendoligez I rebased and addressed your comments, please check. @dbuenzli I was not sure about the cmt files either, but make install installs almost all cmt files - I simply followed the pattern. @mshinwell I am not sure I understand. Do you mean that the gdb support won't work properly, because the sources from many different directories are install flat in compiler-libs? If this is the case, I would suggest to wait until we actually see the problem. It is easy to copy the directory structure into the compiler-libs installation directory, but I would suggest to wait with this. |
|
Thanks @hendriktews ! |
improve installation of additional material (ocaml#827)
…ared This target has been introduced by GPR ocaml#827 but added only to the Unix build system. This commit makes it available to the Windows build system, too.
…ared This target has been introduced by GPR ocaml#827 but added only to the Unix build system. This commit makes it available to the Windows build system, too.
…ared This target has been introduced by GPR ocaml#827 but added only to the Unix build system. This commit makes it available to the Windows build system, too.
…ared This target has been introduced by GPR ocaml#827 but added only to the Unix build system. This commit makes it available to the Windows build system, too.
…ared This target has been introduced by GPR ocaml#827 but added only to the Unix build system. This commit makes it available to the Windows build system, too.
…ared This target has been introduced by GPR ocaml#827 but added only to the Unix build system. This commit makes it available to the Windows build system, too.
…ared This target has been introduced by GPR ocaml#827 but added only to the Unix build system. This commit makes it available to the Windows build system, too.
- install missing mli and cmti files for compiler-libs and otherlibs - new make target install-compiler-sources to install compiler-libs ml files
…ared This target has been introduced by GPR ocaml#827 but added only to the Unix build system. This commit makes it available to the Windows build system, too.
re-introduce sigpending change from trunk
re-introduce sigpending change from trunk
* Reworked dataflow Delete unused [with_formatter] Added priority computation. improve performance of stack operations. Apply suggestions from code review Co-authored-by: Xavier Clerc <xclerc@users.noreply.github.com> Fixed comment. More fixes. Revert priority. * Preinitialize all values in the table. * Add CRs.
* adjust styling of hero links on learn page * fix broken word break on 'take me there' and adjust paddings Co-authored-by: Sabine Schmaltz <sabine@tarides.com>
All the other libraries install the *ml and *mli files together with the compiled library code. This patch fixes this for the compiler-libs library.