cleanup ARC documentation (#15100)

This commit is contained in:
Andreas Rumpf 2020-07-28 11:34:44 +02:00 • committed by GitHub
commit be78b35bb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 44 deletions

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
============