diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-03-05 17:29:48 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-03-05 19:58:54 +0100 |
commit | 4be36d77f6b5d9c32a5f35919dfbb825e9551b0e (patch) | |
tree | 1a3ae91b141cd23d9631de62e088239d2a993176 /doc/manual.rst | |
parent | 20a21aa1848726a60493432b7337ecbfd491f7ac (diff) | |
download | Nim-4be36d77f6b5d9c32a5f35919dfbb825e9551b0e.tar.gz |
introduce tfHasOwned for fast must-move checkings; removed tfAcyclic as the GC has ignored this hint for quite some time now
Diffstat (limited to 'doc/manual.rst')
-rw-r--r-- | doc/manual.rst | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/doc/manual.rst b/doc/manual.rst index a2d51cf08..09daf4a95 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -6925,41 +6925,8 @@ The ``noreturn`` pragma is used to mark a proc that never returns. acyclic pragma -------------- -The ``acyclic`` pragma can be used for object types to mark them as acyclic -even though they seem to be cyclic. This is an **optimization** for the garbage -collector to not consider objects of this type as part of a cycle: - -.. code-block:: nim - type - Node = ref NodeObj - NodeObj {.acyclic.} = object - left, right: Node - data: string - -Or if we directly use a ref object: - -.. code-block:: nim - type - Node = ref object {.acyclic.} - left, right: Node - data: string - -In the example a tree structure is declared with the ``Node`` type. Note that -the type definition is recursive and the GC has to assume that objects of -this type may form a cyclic graph. The ``acyclic`` pragma passes the -information that this cannot happen to the GC. If the programmer uses the -``acyclic`` pragma for data types that are in reality cyclic, the GC may leak -memory, but nothing worse happens. - -**Future directions**: The ``acyclic`` pragma may become a property of a -``ref`` type: - -.. code-block:: nim - type - Node = acyclic ref NodeObj - NodeObj = object - left, right: Node - data: string +The ``acyclic`` pragma applies to type declarations. It is deprecated and +ignored. final pragma |