@@ -2677,10 +2677,8 @@ a parameter has different names between them.
2677
2677
proc foo(y: int) =
2678
2678
echo "Using y: ", y
2679
2679
2680
- foo(x = 2)
2681
- # Using x: 2
2682
- foo(y = 2)
2683
- # Using y: 2
2680
+ foo(x = 2) # Using x: 2
2681
+ foo(y = 2) # Using y: 2
2684
2682
2685
2683
Not supplying the parameter name in such cases results in an
2686
2684
ambiguity error.
@@ -3160,7 +3158,7 @@ Return statement
3160
3158
Example:
3161
3159
3162
3160
.. code-block :: nim
3163
- return 40+ 2
3161
+ return 40 + 2
3164
3162
3165
3163
The `return ` statement ends the execution of the current procedure.
3166
3164
It is only allowed in procedures. If there is an `expr `, this is syntactic
@@ -5859,7 +5857,7 @@ twice:
5859
5857
While macros enable advanced compile-time code transformations, they
5860
5858
cannot change Nim's syntax.
5861
5859
5862
- **Style note **: For code readability, it is best to use the least powerful
5860
+ **Style note: ** For code readability, it is best to use the least powerful
5863
5861
programming construct that remains expressive. So the "check list" is:
5864
5862
5865
5863
(1) Use an ordinary proc/iterator, if possible.
@@ -7108,12 +7106,12 @@ Noalias pragma
7108
7106
Since version 1.4 of the Nim compiler, there is a `.noalias ` annotation for variables
7109
7107
and parameters. It is mapped directly to C/C++'s `restrict `:c: keyword and means that
7110
7108
the underlying pointer is pointing to a unique location in memory, no other aliases to
7111
- this location exist. It is *unchecked * that this alias restriction is followed, if the
7109
+ this location exist. It is *unchecked * that this alias restriction is followed. If the
7112
7110
restriction is violated, the backend optimizer is free to miscompile the code.
7113
7111
This is an **unsafe ** language feature.
7114
7112
7115
7113
Ideally in later versions of the language, the restriction will be enforced at
7116
- compile time. (Which is also why the name `noalias ` was choosen instead of a more
7114
+ compile time. (This is also why the name `noalias ` was choosen instead of a more
7117
7115
verbose name like `unsafeAssumeNoAlias `.)
7118
7116
7119
7117
@@ -7698,7 +7696,7 @@ Example:
7698
7696
{.pragma: rtl, importc, dynlib: "client.dll", cdecl.}
7699
7697
7700
7698
proc p*(a, b: int): int {.rtl.} =
7701
- result = a+ b
7699
+ result = a + b
7702
7700
7703
7701
In the example, a new pragma named `rtl ` is introduced that either imports
7704
7702
a symbol from a dynamic library or exports the symbol for dynamic library
@@ -8105,8 +8103,8 @@ pragmas:
8105
8103
appropriate `locks `:idx: statement.
8106
8104
8107
8105
8108
- Guards and the locks section
8109
- ----------------------------
8106
+ Guards and locks sections
8107
+ -------------------------
8110
8108
8111
8109
Protecting global variables
8112
8110
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -8179,8 +8177,8 @@ The `guard` annotation can also be used to protect fields within an object.
8179
8177
The guard then needs to be another field within the same object or a
8180
8178
global variable.
8181
8179
8182
- Since objects can reside on the heap or on the stack this greatly enhances the
8183
- expressivity of the language:
8180
+ Since objects can reside on the heap or on the stack, this greatly enhances
8181
+ the expressivity of the language:
8184
8182
8185
8183
.. code-block :: nim
8186
8184
0 commit comments