Skip to content

Commit 5610920

Browse files
Araqnarimiran
authored andcommitted
manual.rst: updates [backport] (#14445)
(cherry picked from commit 79e85cb)
1 parent 5b168d3 commit 5610920

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

doc/manual.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,7 @@ Mixing GC'ed memory with ``ptr``
17901790

17911791
Special care has to be taken if an untraced object contains traced objects like
17921792
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
17941794
memory manually:
17951795

17961796
.. code-block:: nim
@@ -1804,12 +1804,12 @@ memory manually:
18041804
d.s = "abc"
18051805
18061806
# tell the GC that the string is not needed anymore:
1807-
GCunref(d.s)
1807+
reset(d.s)
18081808
18091809
# free the memory:
18101810
dealloc(d)
18111811
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
18131813
never be freed. The example also demonstrates two important features for low
18141814
level programming: the ``sizeof`` proc returns the size of a type or value
18151815
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
23502350
# implicit conversion magic happens here
23512351
x = chr
23522352
echo x # => 97
2353-
# you can use the explicit form too
2353+
# one can use the explicit form too
23542354
x = chr.toInt
23552355
echo x # => 97
23562356
@@ -4812,7 +4812,7 @@ compiler. Explicit immediate templates are now deprecated.
48124812
Passing a code block to a template
48134813
----------------------------------
48144814

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
48164816
following the special ``:`` syntax:
48174817

48184818
.. code-block:: nim
@@ -5399,7 +5399,7 @@ generic type ``static[T]``. The type param can be omitted to obtain the type
53995399
class of all constant expressions. A more specific type class can be created by
54005400
instantiating ``static`` with another type class.
54015401

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
54035403
expression by coercing it to a corresponding ``static`` type:
54045404

54055405
.. code-block:: nim
@@ -5413,14 +5413,14 @@ possible type mismatch error.
54135413
typedesc[T]
54145414
-----------
54155415

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
54175417
values. These values exists only during the compilation phase, but since
54185418
all values must have a type, ``typedesc`` is considered their special type.
54195419

54205420
``typedesc`` acts like a generic type. For instance, the type of the symbol
54215421
``int`` is ``typedesc[int]``. Just like with regular generic types, when the
54225422
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.
54245424

54255425
Procs featuring ``typedesc`` params are considered implicitly generic.
54265426
They will be instantiated for each unique combination of supplied types
@@ -5498,7 +5498,7 @@ typeof operator
54985498
**Note**: ``typeof(x)`` can for historical reasons also be written as
54995499
``type(x)`` but ``type(x)`` is discouraged.
55005500

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``
55025502
value from it (in many other languages this is known as the `typeof`:idx:
55035503
operator):
55045504

@@ -5711,9 +5711,9 @@ modules don't need to import a module's dependencies:
57115711
echo $x
57125712
57135713
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.
57155715

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:
57175717

57185718
.. code-block:: nim
57195719
import foo/bar/baz
@@ -6511,7 +6511,7 @@ with the project:
65116511
{.compile: "myfile.cpp".}
65126512
65136513
**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
65156515
of the file.
65166516

65176517

@@ -6531,7 +6531,7 @@ compiler like you would using the commandline switch ``--passC``:
65316531
.. code-block:: Nim
65326532
{.passC: "-Wall -Werror".}
65336533
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
65356535
embed parameters from an external command that will be executed
65366536
during semantic analysis:
65376537

@@ -6541,12 +6541,12 @@ during semantic analysis:
65416541
PassL pragma
65426542
------------
65436543
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``:
65456545

65466546
.. code-block:: Nim
65476547
{.passL: "-lSDLmain -lSDL".}
65486548
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
65506550
embed parameters from an external command that will be executed
65516551
during semantic analysis:
65526552

@@ -6801,7 +6801,7 @@ Importcpp for objects
68016801
~~~~~~~~~~~~~~~~~~~~~
68026802

68036803
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
68056805
language for object types:
68066806

68076807
.. code-block:: nim
@@ -7022,9 +7022,9 @@ specified. It is possible to annotate procs, templates, type and variable
70227022
definitions, statements, etc.
70237023

70247024
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.
70287028

70297029
More examples with custom pragmas:
70307030

0 commit comments

Comments
 (0)