I think that tuples should remain what they are now. Static-length vectors
should be types on their own and interact with tuples, with structs and
with Array<…> in the same way.

newtype should be what enables extension of tuples:

newtype Money = (Int, Int)
extension Money: CustomStringConvertible {
    var description: String {
        return String(format: "$%d.%02d", arguments: [getSelfFirst,
getSelfSecond])
    }
}
let x = (0, 42)let y = x as Money  // errorprint(x.description)  // error
let z = Money(0, 42)print(z.description)  //=> $0.42

Here, getSelfFirst and getSelfSecond are placeholders for some syntax to
access the underlying type.
​
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to