Document import/include outside of top level semantics (#13548)
This commit is contained in:
parent
0f1a4ac96c
commit
525ab5a497
1 changed files with 14 additions and 0 deletions
|
|
@ -5645,6 +5645,8 @@ It is not checked that the ``except`` list is really exported from the module.
|
|||
This feature allows to compile against an older version of the module that
|
||||
does not export these identifiers.
|
||||
|
||||
The ``import`` statement is only allowed at the top level.
|
||||
|
||||
|
||||
Include statement
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
|
@ -5655,6 +5657,18 @@ statement is useful to split up a large module into several files:
|
|||
.. code-block:: nim
|
||||
include fileA, fileB, fileC
|
||||
|
||||
The ``include`` statement can be used outside of the top level, as such:
|
||||
|
||||
.. code-block:: nim
|
||||
# Module A
|
||||
echo "Hello World!"
|
||||
|
||||
.. code-block:: nim
|
||||
# Module B
|
||||
proc main() =
|
||||
include A
|
||||
|
||||
main() # => Hello World!
|
||||
|
||||
|
||||
Module names in imports
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue