summary refs log tree commit diff stats
path: root/doc/manual
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-12-23 17:54:22 +0100
committerAraq <rumpf_a@web.de>2014-12-23 17:54:22 +0100
commitc0cc62c6b17710e6d961198da79a0587e538735f (patch)
tree6609c01bc33c9bbc0d77e7e6af39ffd2161c1332 /doc/manual
parent75b7917b3aba351c5b93c4a552f2081fb90a7668 (diff)
downloadNim-c0cc62c6b17710e6d961198da79a0587e538735f.tar.gz
tuple field names are ignored
Diffstat (limited to 'doc/manual')
-rw-r--r--doc/manual/type_rel.txt1
-rw-r--r--doc/manual/types.txt7
2 files changed, 5 insertions, 3 deletions
diff --git a/doc/manual/type_rel.txt b/doc/manual/type_rel.txt
index 74539f907..805b8637f 100644
--- a/doc/manual/type_rel.txt
+++ b/doc/manual/type_rel.txt
@@ -31,6 +31,7 @@ algorithm (in pseudo-code) determines type equality:
         result = typeEqualsAux(a.baseType, b.baseType, s) and
                  typeEqualsAux(a.indexType, b.indexType, s)
       of tuple:
+        # Note: tuple field names are ignored
         if a.tupleLen == b.tupleLen:
           for i in 0..a.tupleLen-1:
             if not typeEqualsAux(a[i], b[i], s): return false
diff --git a/doc/manual/types.txt b/doc/manual/types.txt
index b8cde8c37..b028752e8 100644
--- a/doc/manual/types.txt
+++ b/doc/manual/types.txt
@@ -508,9 +508,8 @@ defines an *order* of the fields. Tuples are meant for heterogeneous storage
 types with no overhead and few abstraction possibilities. The constructor ``()``
 can be used to construct tuples. The order of the fields in the constructor
 must match the order of the tuple's definition. Different tuple-types are
-*equivalent* if they specify the same fields of the same type in the same
-order. The *names* of the fields also have to be identical but this might
-change in a future version of the language.
+*equivalent* if they specify the same types in the same
+order. The *names* of the fields are ignored.
 
 The assignment operator for tuples copies each component.
 The default assignment operator for objects copies each component. Overloading
@@ -528,6 +527,8 @@ in future versions of the compiler.
   person = (name: "Peter", age: 30)
   # the same, but less readable:
   person = ("Peter", 30)
+  # the same, but with confusing tuple field names:
+  person = (creditCard: "Peter", id: 20)
 
 The implementation aligns the fields for best access performance. The alignment
 is compatible with the way the C compiler does it.