diff options
Diffstat (limited to 'doc/destructors.rst')
-rw-r--r-- | doc/destructors.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/destructors.rst b/doc/destructors.rst index 3c50241eb..ff6ceaf5e 100644 --- a/doc/destructors.rst +++ b/doc/destructors.rst @@ -676,25 +676,25 @@ moveMem(addr y[0], addr x[0], 3) ``` The program fails because we need to prepare a fresh copy for the variable `y`. -`prepareStrMutation` should be called before the address operation. +`prepareMutation` should be called before the address operation. ```nim var x = "abc" var y = x -prepareStrMutation(y) +prepareMutation(y) moveMem(addr y[0], addr x[0], 3) assert y == "abc" ``` -Now `prepareStrMutation` solves the problem. +Now `prepareMutation` solves the problem. It manually creates a fresh copy and makes the variable `y` mutable. ```nim var x = "abc" var y = x -prepareStrMutation(y) +prepareMutation(y) moveMem(addr y[0], addr x[0], 3) moveMem(addr y[0], addr x[0], 3) moveMem(addr y[0], addr x[0], 3) |