diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-07-28 11:34:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-28 11:34:44 +0200 |
commit | be78b35bb8ec45e995e2e27058fc925da11db550 (patch) | |
tree | 2f2ac888bfa7c7ceab2f3316f11acabc33307254 /doc/destructors.rst | |
parent | a2f330569c3d7f59371854b76d7f87de95d1a72b (diff) | |
download | Nim-be78b35bb8ec45e995e2e27058fc925da11db550.tar.gz |
cleanup ARC documentation (#15100)
Diffstat (limited to 'doc/destructors.rst')
-rw-r--r-- | doc/destructors.rst | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/doc/destructors.rst b/doc/destructors.rst index 6cab6e1d2..c97b17d6f 100644 --- a/doc/destructors.rst +++ b/doc/destructors.rst @@ -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 ============ |