summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-08-24 17:33:04 +0200
committerAraq <rumpf_a@web.de>2012-08-24 17:33:04 +0200
commitd17caa86e841489d92165d9caa13c2d8bc86afd5 (patch)
tree9504e5dd71501887da52fbc1f0fd39294ef913ea /doc
parentafcff024a1ab335032aa8a98d844f6fbc701170e (diff)
downloadNim-d17caa86e841489d92165d9caa13c2d8bc86afd5.tar.gz
objects with no ancestor are not implicitely final
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/manual.txt13
-rwxr-xr-xdoc/tut2.txt6
2 files changed, 13 insertions, 6 deletions
diff --git a/doc/manual.txt b/doc/manual.txt
index e0fee2a31..6fccd0ca3 100755
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -970,9 +970,10 @@ in future versions of the compiler.
   person = ("Peter", 30)

 

 The implementation aligns the fields for best access performance. The alignment

-is compatible with the way the C compiler does it. For consistency 
-with ``object`` declarations, tuples in a ``type`` section can also be defined
-with indentation instead of ``[]``:
+is compatible with the way the C compiler does it. 
+
+For consistency  with ``object`` declarations, tuples in a ``type`` section
+can also be defined with indentation instead of ``[]``:
 

 .. code-block:: nimrod

 

@@ -988,7 +989,7 @@ the ``of`` operator can be used to determine the object's type.
 .. code-block:: nimrod

 

   type

-    TPerson = object

+    TPerson {.inheritable.} = object

       name*: string   # the * means that `name` is accessible from other modules

       age: int        # no * means that the field is hidden

 

@@ -1002,7 +1003,9 @@ the ``of`` operator can be used to determine the object's type.
 

 Object fields that should be visible from outside the defining module, have to

 be marked by ``*``. In contrast to tuples, different object types are

-never *equivalent*.

+never *equivalent*. Objects that have no ancestor are implicitely ``final``
+and thus have no hidden type field. One can use the ``inheritable`` pragma to
+introduce new object roots apart from ``system.TObject``.
 

 

 Object variants

diff --git a/doc/tut2.txt b/doc/tut2.txt
index d897319fc..96507bcb1 100755
--- a/doc/tut2.txt
+++ b/doc/tut2.txt
@@ -74,7 +74,11 @@ section.
 
 Inheritance is done with the ``object of`` syntax. Multiple inheritance is
 currently not supported. If an object type has no suitable ancestor, ``TObject``
-can be used as its ancestor, but this is only a convention.
+can be used as its ancestor, but this is only a convention. Objects that have 
+no ancestor are implicitely ``final``. You can use the ``inheritable`` pragma 
+to introduce new object roots apart from ``system.TObject``. (This is used
+in the GTK wrapper for instance.)
+
 
 **Note**: Composition (*has-a* relation) is often preferable to inheritance
 (*is-a* relation) for simple code reuse. Since objects are value types in