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

Add note about nested libraries #3111

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/dune-files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,12 @@ OCaml/Reason modules only consume modules from the directory where the
stanza appear. In order to declare a multi-directory library, you need
to use the :ref:`include_subdirs` stanza.

Note also that a nested library in a project is not automatically namespaced
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The term "nested library" does not exist in the documentation, so I'm not sure what you're referring to?

Copy link
Contributor Author

@yawaramin yawaramin Feb 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm referring to libraries in subdirectories of libraries. Is there a more standard terminology used for that? If so I can easily change to that.

under its parent library. E.g. if you have a public library ``foo`` which nests
another public library ``bar``, it will not be exposed as ``Foo.Bar`` outside
the project, but as ``Bar``. Take care to give unique names to nested libraries
to avoid conflicts. E.g., ``foo__Bar``.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double underscores in names are a (private) artifact of how dune builds modules, I don't think it's a good idea to reuse this kind of names.

Copy link
Contributor Author

@yawaramin yawaramin Feb 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagree, double underscores are a widespread convention in the OCaml community which dune adopted. Dune doesn't 'own' the double underscores naming convention.

[EDIT: to clarify, double underscores are certainly the only relatively unambiguous way to disambiguate toplevel module names in OCaml. Dune can't claim exclusive ownership of that :-)]


``<optional-fields>`` are:

- ``(public_name <name>)`` this is the name under which the library can be
Expand Down