diff options
Diffstat (limited to 'doc/manual/pragmas.txt')
-rw-r--r-- | doc/manual/pragmas.txt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/manual/pragmas.txt b/doc/manual/pragmas.txt index db7ce7e63..835b6909d 100644 --- a/doc/manual/pragmas.txt +++ b/doc/manual/pragmas.txt @@ -102,6 +102,14 @@ collector to not consider objects of this type as part of a cycle: left, right: Node data: string +Or if we directly use a ref object: + +.. code-block:: nim + type + Node = ref object {.acyclic, final.} + 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 |