merge devel
This commit is contained in:
commit
73b7ec9009
309 changed files with 11866 additions and 9591 deletions
|
|
@ -128,7 +128,7 @@ The ``watchpoint`` pragma is syntactically a statement. It can be used
|
|||
to mark a location as a watchpoint:
|
||||
|
||||
.. code-block:: Nim
|
||||
var a: array [0..20, int]
|
||||
var a: array[0..20, int]
|
||||
|
||||
{.watchpoint: a[3].}
|
||||
for i in 0 .. 20: a[i] = i
|
||||
|
|
|
|||
33
doc/koch.rst
33
doc/koch.rst
|
|
@ -35,32 +35,8 @@ options:
|
|||
By default a debug version is created, passing this option will
|
||||
force a release build, which is much faster and should be preferred
|
||||
unless you are debugging the compiler.
|
||||
-d:useGnuReadline
|
||||
Includes the `rdstdin module <rdstdin.html>`_ for `interactive
|
||||
mode <nimc.html#nim-interactive-mode>`_ (aka ``nim i``).
|
||||
This is not needed on Windows. On other platforms this may
|
||||
incorporate the GNU readline library.
|
||||
-d:nativeStacktrace
|
||||
Use native stack traces (only for Mac OS X or Linux).
|
||||
-d:avoidTimeMachine
|
||||
Only for Mac OS X, activating this switch will force excluding
|
||||
the generated ``nimcache`` directories from Time Machine backups.
|
||||
By default ``nimcache`` directories will be included in backups,
|
||||
and just for the Nim compiler itself it means backing up 20MB
|
||||
of generated files each time you update the compiler. Using this
|
||||
option will make the compiler invoke the `tmutil
|
||||
<https://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man8/tmutil.8.html>`_
|
||||
command on all ``nimcache`` directories, setting their backup
|
||||
exclusion bit.
|
||||
|
||||
You can use the following command to locate all ``nimcache``
|
||||
directories and check their backup exclusion bit::
|
||||
|
||||
$ find . -type d -name nimcache -exec tmutil isexcluded \{\} \;
|
||||
--gc:refc|v2|markAndSweep|boehm|go|none
|
||||
Selects which garbage collection strategy to use for the compiler
|
||||
and generated code. See the `Nim's Garbage Collector <gc.html>`_
|
||||
documentation for more information.
|
||||
-d:useLinenoise
|
||||
Use the linenoise library for interactive mode (not needed on Windows).
|
||||
|
||||
After compilation is finished you will hopefully end up with the nim
|
||||
compiler in the ``bin`` directory. You can add Nim's ``bin`` directory to
|
||||
|
|
@ -104,8 +80,3 @@ be rerun in serial fashion so that meaninful error output can be gathered for
|
|||
inspection. The ``--parallelBuild:n`` switch or configuration option can be
|
||||
used to force a specific number of parallel jobs or run everything serially
|
||||
from the start (``n == 1``).
|
||||
|
||||
zip command
|
||||
-----------
|
||||
|
||||
The `zip`:idx: command builds the installation ZIP package.
|
||||
|
|
|
|||
|
|
@ -2531,7 +2531,7 @@ The implicit initialization can be avoided for optimization reasons with the
|
|||
|
||||
.. code-block:: nim
|
||||
var
|
||||
a {.noInit.}: array [0..1023, char]
|
||||
a {.noInit.}: array[0..1023, char]
|
||||
|
||||
If a proc is annotated with the ``noinit`` pragma this refers to its implicit
|
||||
``result`` variable:
|
||||
|
|
@ -3200,7 +3200,7 @@ notation. (Thus an operator can have more than two parameters):
|
|||
# Multiply and add
|
||||
result = a * b + c
|
||||
|
||||
assert `*+`(3, 4, 6) == `*`(a, `+`(b, c))
|
||||
assert `*+`(3, 4, 6) == `+`(`*`(a, b), c)
|
||||
|
||||
|
||||
Export marker
|
||||
|
|
@ -6302,6 +6302,9 @@ modules don't need to import a module's dependencies:
|
|||
var x: MyObject
|
||||
echo $x
|
||||
|
||||
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.
|
||||
|
||||
Note on paths
|
||||
-----------
|
||||
In module related statements, if any part of the module name /
|
||||
|
|
@ -6633,7 +6636,7 @@ Syntactically it has to be used as a statement inside the loop:
|
|||
enumA, enumB, enumC, enumD, enumE
|
||||
|
||||
proc vm() =
|
||||
var instructions: array [0..100, MyEnum]
|
||||
var instructions: array[0..100, MyEnum]
|
||||
instructions[2] = enumC
|
||||
instructions[3] = enumD
|
||||
instructions[4] = enumA
|
||||
|
|
@ -7802,8 +7805,9 @@ Future directions:
|
|||
Threadvar pragma
|
||||
----------------
|
||||
|
||||
A global variable can be marked with the ``threadvar`` pragma; it is
|
||||
a `thread-local`:idx: variable then:
|
||||
A variable can be marked with the ``threadvar`` pragma, which makes it a
|
||||
`thread-local`:idx: variable; Additionally, this implies all the effects
|
||||
of the ``global`` pragma.
|
||||
|
||||
.. code-block:: nim
|
||||
var checkpoints* {.threadvar.}: seq[string]
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ Conventions for multi-line statements and expressions
|
|||
LongTupleA = tuple[wordyTupleMemberOne: int, wordyTupleMemberTwo: string,
|
||||
wordyTupleMemberThree: float]
|
||||
|
||||
- Similarly, any procedure and procedure type declarations that are longer#
|
||||
- Similarly, any procedure and procedure type declarations that are longer
|
||||
than one line should do the same thing.
|
||||
|
||||
.. code-block:: nim
|
||||
|
|
@ -198,4 +198,4 @@ Conventions for multi-line statements and expressions
|
|||
|
||||
.. code-block:: nim
|
||||
startProcess(nimExecutable, currentDirectory, compilerArguments
|
||||
environment, processOptions)
|
||||
environment, processOptions)
|
||||
|
|
|
|||
10
doc/tut1.rst
10
doc/tut1.rst
|
|
@ -944,12 +944,8 @@ String variables are **mutable**, so appending to a string
|
|||
is possible, and quite efficient. Strings in Nim are both zero-terminated and have a
|
||||
length field. A string's length can be retrieved with the builtin ``len``
|
||||
procedure; the length never counts the terminating zero. Accessing the
|
||||
terminating zero is not an error and often leads to simpler code:
|
||||
|
||||
.. code-block:: nim
|
||||
if s[i] == 'a' and s[i+1] == 'b':
|
||||
# no need to check whether ``i < len(s)``!
|
||||
...
|
||||
terminating zero is an error, it only exists so that a Nim string can be converted
|
||||
to a ``cstring`` without doing a copy.
|
||||
|
||||
The assignment operator for strings copies the string. You can use the ``&``
|
||||
operator to concatenate strings and ``add`` to append to a string.
|
||||
|
|
@ -960,7 +956,7 @@ enforced. For example, when reading strings from binary files, they are merely
|
|||
a sequence of bytes. The index operation ``s[i]`` means the i-th *char* of
|
||||
``s``, not the i-th *unichar*.
|
||||
|
||||
String variables are initialized with the empty strings ``""``.
|
||||
A string variable is initialized with the empty string ``""``.
|
||||
|
||||
|
||||
Integers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue