@@ -1790,7 +1790,7 @@ Mixing GC'ed memory with ``ptr``
1790
1790
1791
1791
Special care has to be taken if an untraced object contains traced objects like
1792
1792
traced references, strings or sequences: in order to free everything properly,
1793
- the built-in procedure ``GCunref `` has to be called before freeing the untraced
1793
+ the built-in procedure ``reset `` has to be called before freeing the untraced
1794
1794
memory manually:
1795
1795
1796
1796
.. code-block :: nim
@@ -1804,12 +1804,12 @@ memory manually:
1804
1804
d.s = "abc"
1805
1805
1806
1806
# tell the GC that the string is not needed anymore:
1807
- GCunref (d.s)
1807
+ reset (d.s)
1808
1808
1809
1809
# free the memory:
1810
1810
dealloc(d)
1811
1811
1812
- Without the ``GCunref `` call the memory allocated for the ``d.s `` string would
1812
+ Without the ``reset `` call the memory allocated for the ``d.s `` string would
1813
1813
never be freed. The example also demonstrates two important features for low
1814
1814
level programming: the ``sizeof `` proc returns the size of a type or value
1815
1815
in bytes. The ``cast `` operator can circumvent the type system: the compiler
@@ -2350,7 +2350,7 @@ The convertible relation can be relaxed by a user-defined type
2350
2350
# implicit conversion magic happens here
2351
2351
x = chr
2352
2352
echo x # => 97
2353
- # you can use the explicit form too
2353
+ # one can use the explicit form too
2354
2354
x = chr.toInt
2355
2355
echo x # => 97
2356
2356
@@ -4812,7 +4812,7 @@ compiler. Explicit immediate templates are now deprecated.
4812
4812
Passing a code block to a template
4813
4813
----------------------------------
4814
4814
4815
- You can pass a block of statements as the last argument to a template
4815
+ One can pass a block of statements as the last argument to a template
4816
4816
following the special ``: `` syntax:
4817
4817
4818
4818
.. code-block :: nim
@@ -5399,7 +5399,7 @@ generic type ``static[T]``. The type param can be omitted to obtain the type
5399
5399
class of all constant expressions. A more specific type class can be created by
5400
5400
instantiating ``static `` with another type class.
5401
5401
5402
- You can force an expression to be evaluated at compile time as a constant
5402
+ One can force an expression to be evaluated at compile time as a constant
5403
5403
expression by coercing it to a corresponding ``static `` type:
5404
5404
5405
5405
.. code-block :: nim
@@ -5413,14 +5413,14 @@ possible type mismatch error.
5413
5413
typedesc[T]
5414
5414
-----------
5415
5415
5416
- In many contexts, Nim allows you to treat the names of types as regular
5416
+ In many contexts, Nim allows to treat the names of types as regular
5417
5417
values. These values exists only during the compilation phase, but since
5418
5418
all values must have a type, ``typedesc `` is considered their special type.
5419
5419
5420
5420
``typedesc `` acts like a generic type. For instance, the type of the symbol
5421
5421
``int `` is ``typedesc[int] ``. Just like with regular generic types, when the
5422
5422
generic param is omitted, ``typedesc `` denotes the type class of all types.
5423
- As a syntactic convenience, you can also use ``typedesc `` as a modifier.
5423
+ As a syntactic convenience, one can also use ``typedesc `` as a modifier.
5424
5424
5425
5425
Procs featuring ``typedesc `` params are considered implicitly generic.
5426
5426
They will be instantiated for each unique combination of supplied types
@@ -5498,7 +5498,7 @@ typeof operator
5498
5498
**Note **: ``typeof(x) `` can for historical reasons also be written as
5499
5499
``type(x) `` but ``type(x) `` is discouraged.
5500
5500
5501
- You can obtain the type of a given expression by constructing a ``typeof ``
5501
+ One can obtain the type of a given expression by constructing a ``typeof ``
5502
5502
value from it (in many other languages this is known as the `typeof `:idx:
5503
5503
operator):
5504
5504
@@ -5711,9 +5711,9 @@ modules don't need to import a module's dependencies:
5711
5711
echo $x
5712
5712
5713
5713
When the exported symbol is another module, all of its definitions will
5714
- be forwarded. You can use an ``except `` list to exclude some of the symbols.
5714
+ be forwarded. One can use an ``except `` list to exclude some of the symbols.
5715
5715
5716
- Notice that when exporting, you need to specify only the module name:
5716
+ Notice that when exporting, one needs to specify only the module name:
5717
5717
5718
5718
.. code-block :: nim
5719
5719
import foo/bar/baz
@@ -6511,7 +6511,7 @@ with the project:
6511
6511
{.compile: "myfile.cpp".}
6512
6512
6513
6513
**Note **: Nim computes a SHA1 checksum and only recompiles the file if it
6514
- has changed. You can use the ``-f `` command line option to force recompilation
6514
+ has changed. One can use the ``-f `` command line option to force recompilation
6515
6515
of the file.
6516
6516
6517
6517
@@ -6531,7 +6531,7 @@ compiler like you would using the commandline switch ``--passC``:
6531
6531
.. code-block :: Nim
6532
6532
{.passC: "-Wall -Werror".}
6533
6533
6534
- Note that you can use ``gorge `` from the `system module <system.html >`_ to
6534
+ Note that one can use ``gorge `` from the `system module <system.html >`_ to
6535
6535
embed parameters from an external command that will be executed
6536
6536
during semantic analysis:
6537
6537
@@ -6541,12 +6541,12 @@ during semantic analysis:
6541
6541
PassL pragma
6542
6542
------------
6543
6543
The ``passL `` pragma can be used to pass additional parameters to the linker
6544
- like you would using the commandline switch ``--passL ``:
6544
+ like one would using the commandline switch ``--passL ``:
6545
6545
6546
6546
.. code-block :: Nim
6547
6547
{.passL: "-lSDLmain -lSDL".}
6548
6548
6549
- Note that you can use ``gorge `` from the `system module <system.html >`_ to
6549
+ Note that one can use ``gorge `` from the `system module <system.html >`_ to
6550
6550
embed parameters from an external command that will be executed
6551
6551
during semantic analysis:
6552
6552
@@ -6801,7 +6801,7 @@ Importcpp for objects
6801
6801
~~~~~~~~~~~~~~~~~~~~~
6802
6802
6803
6803
Generic ``importcpp ``'ed objects are mapped to C++ templates. This means that
6804
- you can import C++'s templates rather easily without the need for a pattern
6804
+ one can import C++'s templates rather easily without the need for a pattern
6805
6805
language for object types:
6806
6806
6807
6807
.. code-block :: nim
@@ -7022,9 +7022,9 @@ specified. It is possible to annotate procs, templates, type and variable
7022
7022
definitions, statements, etc.
7023
7023
7024
7024
Macros module includes helpers which can be used to simplify custom pragma
7025
- access `hasCustomPragma `, `getCustomPragmaVal `. Please consult macros module
7026
- documentation for details. These macros are no magic, they don't do anything
7027
- you cannot do yourself by walking AST object representation.
7025
+ access `hasCustomPragma `, `getCustomPragmaVal `. Please consult the macros module
7026
+ documentation for details. These macros are not magic, everything they do can
7027
+ also be achieved by walking the AST of the object representation.
7028
7028
7029
7029
More examples with custom pragmas:
7030
7030
0 commit comments