Reorganize the Modules chapter of the manual. (#38271)
* Reorganize the Modules chapter of the manual.
Main changes
Namespaces, export, import, using
- explain namespaces, qualified symbol names, and export lists
- consolidate examples where applicable
- fix examples which were outdated after #25306
- distribute the “Namespace miscellanea” section into parts in the appropriate sections
- break up the summary table and explain each case in detail with examples
- subsection on various strategies to handle symbol conflicts
- use “bring into the namespace/scope” instead of “import” in the text, as readers confuse it with `import`
- explicitly document what happens with multiple `using` / `import` statements
- add relevant style / best practices suggestions which are now widely used in the Julia ecosystem
Submodules
- discuss usage of `using ParentModule.SubModule` etc (relies on code loading)
- add submodule examples where order matters, fixes #38011 (also another example by @rdeits [from Discourse](https://discourse.julialang.org/t/problem-with-using-in-submodules/42321/2))
- mention that submodules do not “inherit” scope from parent
Misc incidental changes
- in the Methods chapter, add a note about adding methods to functions in other modules
- add a markdown id to the code-loading chapter
The “Module initialization and precompilation” section is left unchanged.
Co-authored-by: Tim Holy <tim.holy@gmail.com>
Co-authored-by: Simon Byrne <simonbyrne@gmail.com>