Here is something that has been puzzling me. I have a multi-library package, with a bunch of different dune
files for each library. The package itself has a number of dependencies, and then the libraries specify their individual dependenceis on these by including them in the libraries
dune stanza.
I had assumed that if there is not an entry for foo
in the libraries
stanza of a given dune library, then the code of foo
will not be in scope within that library. This seems to me to be a rather important hygiene property, and it really surprised me to find that it is false. As it happens, I can remove certainly libraries from the libraries
stanza and their code continues to be in scope.
One hypothesis I had is that the libraries
may have transitive semantics (so if I depend on a library bar
that depends on foo
, then I will have the content of foo
in scope). If that is what is happening, it does make sense from an implementation point of view, but I think it does not make sense from a semantical point of view, nor from the point of view of dune files as documenting a library’s input interface in the world of separate compilation.
I am curious if this behaviour would be thought of as a bug, or a design decision — and, if the latter, whether there is some appetite to change the behaviour to allow users of dune to maintain clear and direct control over scope without ‘spooky action at a distance’.