mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 20:17:42 +00:00
minor updates on manual (#20258)
* minor updates on manual 1. statement -> keyword: 1. re-phase on the explanation of `import except`: maybe the newer version does not export some of the identifiers; 1. "The original module name is then not accessible" is moved up to the previous paragraph, since it is coupled with the previous paragraph, but not the current one. 1. re-phase on the explanation of _Disabling certain messages_. * Apply suggestions from code review Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Update manual.md do not use "()". * Update doc/manual.md Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
This commit is contained in:
@@ -3944,7 +3944,7 @@ argument in inline calls, as well as a direct mirror of Nim's routine syntax.
|
||||
macroResults.add quote do:
|
||||
if not `ex`:
|
||||
echo `info`, ": Check failed: ", `expString`
|
||||
|
||||
|
||||
# Processing a routine definition in a macro:
|
||||
rpc(router, "add") do (a, b: int) -> int:
|
||||
result = a + b
|
||||
@@ -6160,7 +6160,7 @@ as arguments if called in statement form.
|
||||
# to perform the task
|
||||
do:
|
||||
# code to undo it
|
||||
|
||||
|
||||
let num = 12
|
||||
# a single colon may be used if there is no initial block
|
||||
match (num mod 3, num mod 5):
|
||||
@@ -6499,7 +6499,7 @@ This is best illustrated by an example:
|
||||
Import statement
|
||||
----------------
|
||||
|
||||
After the `import` statement, a list of module names can follow or a single
|
||||
After the `import` keyword, a list of module names can follow or a single
|
||||
module name followed by an `except` list to prevent some symbols from being
|
||||
imported:
|
||||
|
||||
@@ -6512,8 +6512,8 @@ imported:
|
||||
|
||||
|
||||
It is not checked that the `except` list is really exported from the module.
|
||||
This feature allows us to compile against an older version of the module that
|
||||
does not export these identifiers.
|
||||
This feature allows us to compile against different versions of the module,
|
||||
even when one version does not export some of these identifiers.
|
||||
|
||||
The `import` statement is only allowed at the top level.
|
||||
|
||||
@@ -6548,7 +6548,8 @@ The `include` statement can be used outside the top level, as such:
|
||||
Module names in imports
|
||||
-----------------------
|
||||
|
||||
A module alias can be introduced via the `as` keyword:
|
||||
A module alias can be introduced via the `as` keyword, after which the original module name
|
||||
is inaccessible:
|
||||
|
||||
```nim
|
||||
import std/strutils as su, std/sequtils as qu
|
||||
@@ -6556,8 +6557,7 @@ A module alias can be introduced via the `as` keyword:
|
||||
echo su.format("$1", "lalelu")
|
||||
```
|
||||
|
||||
The original module name is then not accessible. The notations
|
||||
`path/to/module` or `"path/to/module"` can be used to refer to a module
|
||||
The notations `path/to/module` or `"path/to/module"` can be used to refer to a module
|
||||
in subdirectories:
|
||||
|
||||
```nim
|
||||
@@ -6614,7 +6614,7 @@ It is recommended and preferred but not currently enforced that all stdlib modul
|
||||
From import statement
|
||||
---------------------
|
||||
|
||||
After the `from` statement, a module name followed by
|
||||
After the `from` keyword, a module name followed by
|
||||
an `import` to list the symbols one likes to use without explicit
|
||||
full qualification:
|
||||
|
||||
@@ -7175,8 +7175,9 @@ Disabling certain messages
|
||||
--------------------------
|
||||
Nim generates some warnings and hints ("line too long") that may annoy the
|
||||
user. A mechanism for disabling certain messages is provided: Each hint
|
||||
and warning message contains a symbol in brackets. This is the message's
|
||||
identifier that can be used to enable or disable it:
|
||||
and warning message is associated with a symbol. This is the message's
|
||||
identifier, which can be used to enable or disable the message by putting it
|
||||
in brackets following the pragma:
|
||||
|
||||
```Nim
|
||||
{.hint[LineTooLong]: off.} # turn off the hint about too long lines
|
||||
|
||||
Reference in New Issue
Block a user