The 'completing generics' document Doug put together has a section on this: https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#extensions-of-structural-types <https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#extensions-of-structural-types>
Austin > On Jan 9, 2017, at 12:38 AM, Tyler Cloutier via swift-evolution > <swift-evolution@swift.org> wrote: > > I’ll tell you it, though, it would be really nice to be able to add functions > to tuples, just as they are done with structs. > > Perhaps there is a way to formalize tuples as unnamed or anonymous Structs? > It would make them going away strictly by making them more powerful. > > > >> On Jan 8, 2017, at 12:35 PM, Tino Heth via swift-evolution >> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote: >> >> >>> 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: >> Closures*. >> 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() >> } >> } >> >> _______________________________________________ >> swift-evolution mailing list >> swift-evolution@swift.org <mailto:swift-evolution@swift.org> >> https://lists.swift.org/mailman/listinfo/swift-evolution > > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution