diff options
author | Araq <rumpf_a@web.de> | 2016-11-23 23:23:31 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2016-11-23 23:23:31 +0100 |
commit | 074f276c8a753bbb85788777b7c58a074f41329f (patch) | |
tree | d5078972eb1cbd23f7ce59b63e13bb31f02196d6 /doc/manual/modules.txt | |
parent | 204838b3585d13ea88d3b8ac8e7f0fc19e55f3e9 (diff) | |
download | Nim-074f276c8a753bbb85788777b7c58a074f41329f.tar.gz |
disallow recursive module dependencies
Diffstat (limited to 'doc/manual/modules.txt')
-rw-r--r-- | doc/manual/modules.txt | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/doc/manual/modules.txt b/doc/manual/modules.txt index 9cb6a11af..8a9f5ff65 100644 --- a/doc/manual/modules.txt +++ b/doc/manual/modules.txt @@ -9,36 +9,8 @@ subtle. Only top-level symbols that are marked with an asterisk (``*``) are exported. A valid module name can only be a valid Nim identifier (and thus its filename is ``identifier.nim``). -The algorithm for compiling modules is: - -- compile the whole module as usual, following import statements recursively - -- if there is a cycle only import the already parsed symbols (that are - exported); if an unknown identifier occurs then abort - -This is best illustrated by an example: - -.. code-block:: nim - # Module A - type - T1* = int # Module A exports the type ``T1`` - import B # the compiler starts parsing B - - proc main() = - var i = p(3) # works because B has been parsed completely here - - main() - - -.. code-block:: nim - # Module B - import A # A is not parsed here! Only the already known symbols - # of A are imported. - - proc p*(x: A.T1): A.T1 = - # this works because the compiler has already - # added T1 to A's interface symbol table - result = x + 1 +Recursive module dependencies are not allowed. This restriction might be mitigated +or removed in later versions of the language. Import statement |