Open NatKarmios opened 1 year ago
When you install private libraries in a package, their interface files will no longer appear to consumers. This is detailed in the (package)
section of the library stanza doc: https://dune.readthedocs.io/en/stable/dune-files.html#library
The error message I get in Dune 3.7+ is:
File "executable/MyExe/bin/myexe.ml", line 1, characters 5-32:
1 | open Mylib.Utils.Syntaxes.Option
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: The module Mylib.Utils is an alias for module Utils, which is missing
[1]
Which I don't think can be any better.
Maybe we can add a note to the documentation about making module aliases of modules of a private library. Since I don't see any realistic way to allow for such a behaviour.
I understand that this may be intended behaviour; if that is the case, should the compiler, when compiling the library, warn about exposed interfaces that can't be used?
You're allowed to do this, but I think you need to write the interface of your module explicitly.
Alternatively, you could try doing (libraries (re_export utils))
which should work. Although it might not, because I've never thought about this use case.
Suppose I'm writing a library, and I want to simplify the interface and documentation by making all but the toplevel module private using the
package
stanza, where the toplevel module re-exposes code from private packages.When I try add this library as a dependency, and try use that private code via the re-exposed interface, compilation fails with missing
.cmi
s.I understand that this may be intended behaviour; if that is the case, should the compiler, when compiling the library, warn about exposed interfaces that can't be used?
A minimal reproduction can be found here: https://github.com/NatKarmios/dune-private-bug