diff options
author | narimiran <narimiran@disroot.org> | 2019-02-07 16:10:48 +0100 |
---|---|---|
committer | narimiran <narimiran@disroot.org> | 2019-02-07 16:10:48 +0100 |
commit | 27364ece144f1ff764ca7d87cc5dd03fa66832ae (patch) | |
tree | b418c9030ec8362cf9ef56186c4bfa302a6f811e /doc/manual.rst | |
parent | 84d10f7d8a9488d4b5be3cccb582f966fc02aa64 (diff) | |
download | Nim-27364ece144f1ff764ca7d87cc5dd03fa66832ae.tar.gz |
mention correct usage of `export` in the manual, fixes #6227 [ci skip]
Diffstat (limited to 'doc/manual.rst')
-rw-r--r-- | doc/manual.rst | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/doc/manual.rst b/doc/manual.rst index e06192780..7b0a30f6a 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -46,7 +46,7 @@ and ``a ^* b`` is short for ``(a (b a)*)?``. Example:: arrayConstructor = '[' expr ^* ',' ']' -Other parts of Nim, like scoping rules or runtime semantics, are +Other parts of Nim, like scoping rules or runtime semantics, are described informally. @@ -724,7 +724,7 @@ expression: * built-in operators * previously declared constants and compile-time variables * previously declared macros and templates -* previously declared procedures that have no side effects beyond +* previously declared procedures that have no side effects beyond possibly modifying compile-time variables A constant expression can contain code blocks that may internally use all Nim @@ -2769,7 +2769,7 @@ Even some code that has side effects is permitted in a static block: echo "echo at compile time" There are limitations on what Nim code can be executed at compile time; -see `Restrictions on Compile-Time Execution +see `Restrictions on Compile-Time Execution <#restrictions-on-compileminustime-execution>`_ for details. It's a static error if the compiler cannot execute the block at compile time. @@ -2847,8 +2847,8 @@ empty ``discard`` statement should be used. For non ordinal types it is not possible to list every possible value and so these always require an ``else`` part. -Because case statements are checked for exhaustiveness during semantic analysis, -the value in every ``of`` branch must be a constant expression. +Because case statements are checked for exhaustiveness during semantic analysis, +the value in every ``of`` branch must be a constant expression. This restriction also allows the compiler to generate more performant code. As a special semantic extension, an expression in an ``of`` branch of a case @@ -2907,7 +2907,7 @@ When nimvm statement -------------------- ``nimvm`` is a special symbol, that may be used as expression of ``when nimvm`` -statement to differentiate execution path between compile time and the +statement to differentiate execution path between compile time and the executable. Example: @@ -4459,8 +4459,8 @@ a `type variable`:idx:. Is operator ----------- -The ``is`` operator is evaluated during semantic analysis to check for type -equivalence. It is therefore very useful for type specialization within generic +The ``is`` operator is evaluated during semantic analysis to check for type +equivalence. It is therefore very useful for type specialization within generic code: .. code-block:: nim @@ -5460,18 +5460,18 @@ Macros A macro is a special function that is executed at compile time. Normally the input for a macro is an abstract syntax tree (AST) of the code that is passed to it. The macro can then do -transformations on it and return the transformed AST. This can be used to +transformations on it and return the transformed AST. This can be used to add custom language features and implement `domain specific languages`:idx:. Macro invocation is a case where semantic analyis does **not** entirely proceed -top to bottom and left to right. Instead, semantic analysis happens at least -twice: +top to bottom and left to right. Instead, semantic analysis happens at least +twice: * Semantic analysis recognizes and resolves the macro invocation. * The compiler executes the macro body (which may invoke other procs). * It replaces the AST of the macro invocation with the AST returned by the macro. * It repeats semantic analysis of that region of the code. -* If the AST returned by the macro contains other macro invocations, +* If the AST returned by the macro contains other macro invocations, this process iterates. While macros enable advanced compile-time code transformations, they @@ -6653,6 +6653,13 @@ modules don't need to import a module's dependencies: When the exported symbol is another module, all of its definitions will be forwarded. You can use an ``except`` list to exclude some of the symbols. +Notice that when exporting, you need to specify only the module name: + +.. code-block:: nim + import foo/bar/baz + export baz + + Scope rules ----------- @@ -7437,7 +7444,7 @@ compiler like you would using the commandline switch ``--passC``: {.passC: "-Wall -Werror".} Note that you can use ``gorge`` from the `system module <system.html>`_ to -embed parameters from an external command that will be executed +embed parameters from an external command that will be executed during semantic analysis: .. code-block:: Nim @@ -7452,7 +7459,7 @@ like you would using the commandline switch ``--passL``: {.passL: "-lSDLmain -lSDL".} Note that you can use ``gorge`` from the `system module <system.html>`_ to -embed parameters from an external command that will be executed +embed parameters from an external command that will be executed during semantic analysis: .. code-block:: Nim |