diff options
author | flywind <xzsflywind@gmail.com> | 2021-03-03 08:08:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-03 08:08:52 +0800 |
commit | a04c9d1f6215a52c89e1e641ea2afcf4ce2a90de (patch) | |
tree | cb61282b6661ef2c7872247edde5e8c1143b045a /doc | |
parent | 87897fa2d6b5c256606f05af2d0fd74643cce542 (diff) | |
download | Nim-a04c9d1f6215a52c89e1e641ea2afcf4ce2a90de.tar.gz |
rename prepareStrMutation to prepareMutation (#17235)
* remove unnecessary when statement * remove outdated codes * rename prepareStrMutation to prepareMutation
Diffstat (limited to 'doc')
-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) |