Tuple type inconsistency

Then how about this:

var a = (x: 1, y: 2)
var b = (y: 2, x: 1)

// All their elements are equal:
print(a.x == b.x) // true
print(a.y == b.y) // true

// But the tuples themselves are not equal:
print(a == b) // false

// We can assign them to each other:
a = b // OK
b = a // OK

// But even now, after `b = a`, they are still not equal:
print(a == b) // false

// But watch this:
a = (x: 1, y: 2)
b = (x: 2, y: 1)
print(a == b) // true(!)

// And this:
a = b
print(a == b) // false(!)
4 Likes