[swift-evolution] [Proposal] Tuple Extensions

Developer devteam.codafi at gmail.com
Tue May 3 23:13:16 CDT 2016

I’ve been contemplating this idea for a while now, mostly because I think it’s a very important feature, but also because I can’t find a single example of a programming language getting it completely right.  In Swift, the motif of tuples throughout the language would lead one to think that they have some kind of special status in the language.  Yet, tuples are an opaque concept exposed by the compiler to the end user with no opportunity for extension.  Languages that have tried to expose tuples to their users for extension have done so in less than ideal ways (see Tuple1-Tuple22 Scala <https://github.com/scala/scala/blob/2.12.x/src/library/scala/Tuple22.scala>, Haskell <https://github.com/ghc/ghc/blob/master/libraries/ghc-prim/GHC/Tuple.hs>’s hard limit on tuples, Rust <https://doc.rust-lang.org/std/primitive.tuple.html>’s limitations for std::tuple), yet each implementation has something to offer a possible Swift implementation.  I see only one course of action that will bring us extensible tuples in a manner that is compatible with Swift and its overall design philosophy.  To that end, I have drawn up a draft proposal <https://gist.github.com/CodaFi/18b70633b03e19161402ae3579c072b7> for generic tuple extensions that I will submit to swift-evolution shortly.

All the best,

~Robert Widmann

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160504/c8e0763e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160504/c8e0763e/attachment.sig>

More information about the swift-evolution mailing list