From c0cc62c6b17710e6d961198da79a0587e538735f Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 23 Dec 2014 17:54:22 +0100 Subject: tuple field names are ignored --- doc/manual/type_rel.txt | 1 + doc/manual/types.txt | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'doc/manual') 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. -- cgit 1.4.1-2-gfad0