Just a thought if parentheses is important, why the tuples are not?
var tuple1: (Int, Int) = (0, 0) var tuple2: ((((Int, Int)))) = (0, 0) type(of: tuple1) == type(of: tuple2) // true var void: ((((((())))))) = () type(of: void) == type(of: Void()) // true 2017-06-07 10:15 GMT+08:00 Susan Cheng <[email protected]>: > Introduction > > Because the painful of SE-0110, here is a proposal to clarify the tuple > syntax. > > Proposed solution > 1. single element tuple always be flattened > > let tuple1: (((Int))) = 0 // TypeOf(tuple1) == Int > > > let tuple2: ((((Int))), Int) = (0, 0) // TypeOf(tuple2) == (Int, Int) > > 2. function arguments list also consider as a tuple, which means the > function that accept a single tuple should always be flattened. > > let fn1: (Int, Int) -> Void = { _, _ in } > > > let fn2: ((Int, Int)) -> Void = { _, _ in } // always flattened > > let fn3: (Int, Int) -> Void = { _ in } // not allowed, here are two > arguments > > let fn4: ((Int, Int)) -> Void = { _ in } // not allowed, here are two > arguments > >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
