-
Notifications
You must be signed in to change notification settings - Fork 416
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
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``. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.