cleanup ARC documentation (#15100)

This commit is contained in:
Andreas Rumpf
2020-07-28 11:34:44 +02:00
committed by GitHub
parent a2f330569c
commit be78b35bb8
2 changed files with 0 additions and 44 deletions

View File

@@ -146,8 +146,6 @@ Advanced options:
--legacy:$2
enable obsolete/legacy language feature
--useVersion:1.0 emulate Nim version X of the Nim compiler
--newruntime use an alternative runtime that uses destructors
and that uses a shared heap via -d:useMalloc
--profiler:on|off enable profiling; requires `import nimprof`, and
works better with `--stackTrace:on`
see also https://nim-lang.github.io/Nim/estp.html

View File

@@ -534,48 +534,6 @@ indirections:
useItAgain(v)
Owned refs
==========
**Note**: The ``owned`` type constructor is only available with
the ``--newruntime`` compiler switch and is experimental.
Let ``W`` be an ``owned ref`` type. Conceptually its hooks look like:
.. code-block:: nim
proc `=destroy`(x: var W) =
if x != nil:
assert x.refcount == 0, "dangling unowned pointers exist!"
`=destroy`(x[])
proc `=`(x: var W; y: W) {.error: "owned refs can only be moved".}
proc `=sink`(x: var W; y: W) =
`=destroy`(x)
bitwiseCopy x, y # raw pointer copy
Let ``U`` be an unowned ``ref`` type. Conceptually its hooks look like:
.. code-block:: nim
proc `=destroy`(x: var U) =
if x != nil:
dec x.refcount
proc `=`(x: var U; y: U) =
# Note: No need to check for self-assignments here.
if y != nil: inc y.refcount
if x != nil: dec x.refcount
bitwiseCopy x, y # raw pointer copy
proc `=sink`(x: var U, y: U) {.error.}
# Note: Moves are not available.
Hook lifting
============