[swift-evolution] [Pitch] Eliminate tuples - unify member access syntax

Tino Heth 2th at gmx.de
Sun Jan 8 14:35:35 CST 2017

> The point of this comparison is to point out that the anonymous type generating tuple is a) superfluous and b) a source of confusion and gratuitous complexity.  It assumes the role at times of immutable arrays, anonymous structs, and immutable dictionaries depending on context and we already have all of those things.  

There is another anonymous type — and it's very popular right now:
They are also a potential source of confusion (and even more complexity ;-), so should they be removed as well?

I guess we'll keep both, but you are definitely right that there is much complexity… but I'd rather improve that not by removing features, but by adding more regularity:
There has been a discussion about anonymous enums as well, and if we could come up with a syntax for anonymous reference types, imho everything would feel simpler.

Most likely someone already mentioned this, but tuples can be used in assignments in a way that isn't possible with any of the alternatives:

func tupleTest() -> (String, Int) {
	return ("Foo", 10)

let (name, count) = tupleTest()

print("There are \(count) \(name)")

- Tino

* so there is yet another (odd) variant:

var cxy = { (c: Character) -> Int in
	switch (c) {
	case "x": return 1
	case "y": return 2
	default: fatalError()

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170108/6acff2c4/attachment.html>

More information about the swift-evolution mailing list