This commit is contained in:
Andreas Rumpf
2021-04-23 13:50:27 +02:00
committed by GitHub
parent dce0b3b002
commit 511b6d2449
2 changed files with 6 additions and 6 deletions

View File

@@ -86,7 +86,7 @@ type
typeInst*: PackedItemId
nonUniqueId*: int32
PackedNode* = object # 20 bytes
PackedNode* = object # 28 bytes
kind*: TNodeKind
flags*: TNodeFlags
operand*: int32 # for kind in {nkSym, nkSymDef}: SymId

View File

@@ -277,7 +277,7 @@ inference. But it has to be enabled via `--sinkInference:on`, either
on the command line or via a `push` pragma.
To enable it for a section of code, one can
use `{.push sinkInference: on.}`...`{.pop.}`.
use `{.push sinkInference: on.}` ... `{.pop.}`.
The `.nosinks`:idx: pragma can be used to disable this inference
for a single routine:
@@ -661,12 +661,12 @@ There is no copy during assigning operations.
y[0] = 'h' # copy
The program above shows when the copy operations happen.
When mutating the variable `y`, the Nim compiler creates a fresh copy of `x`,
the variable `y` won't point to the string literal anymore.
Instead it points to the copy of `x` of which the memory can be mutated
When mutating the variable `y`, the Nim compiler creates a fresh copy of `x`,
the variable `y` won't point to the string literal anymore.
Instead it points to the copy of `x` of which the memory can be mutated
and the variable `y` becomes a mutable string.
.. Note:: The abstraction fails for `addr x` because whether the address is going to be used for mutations is unknown.
.. Note:: The abstraction fails for `addr x` because whether the address is going to be used for mutations is unknown.
Let's look at a silly example demonstrating this behaviour: