revert to old behaviour: tuple field names are not ignored anymore; fixes #1920
This commit is contained in:
parent
a2b7e6c392
commit
abb738146a
9 changed files with 40 additions and 17 deletions
|
|
@ -31,7 +31,6 @@ 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
|
||||
|
|
|
|||
|
|
@ -508,8 +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 types in the same
|
||||
order. The *names* of the fields are ignored.
|
||||
*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.
|
||||
|
||||
The assignment operator for tuples copies each component.
|
||||
The default assignment operator for objects copies each component. Overloading
|
||||
|
|
@ -527,8 +527,6 @@ 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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue