[swift-evolution] Tuples as Named Types
Muhammad Tahir Vali
tahir.vali13 at gmail.com
Thu Sep 15 23:54:33 CDT 2016
The purpose of this proposal is to implement Tuples as a named typed in
Swift. Tuples can be extremely useful for pattern matching, returning
multiple values from a function, and destructing content to the list. C#
has tuples as a named type as well I believe. Currently, Tuples in Swift
are anonymous types that have limited functionality but this proposal can
help solve that.
The underlying implementations of this proposal can allow the following :
1) having parameters and return values of type : Tuple
- enforces much more intuitive and clean code
- less code too read
2) implicit & explicit optionals with tuples !!!
- Can definitely take out many nested optional chains if tuples internally
checks for .Some or .None in each variable stored inside of an optional of
type Tuple.
3) making tuples variable declarations more popular for functional call
- parameter names in function calls within tuple variables can be used as
getter
My proposal was very brief but I hope its one worth embracing. I didnt get
to talk about applications but those are pretty self-explanatory. This
definitely widens the vision for Swift and could be a "a-ha" thing for
Swift developers. :)
--
Best Regards,
Muhammad T. Vali
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160916/66c41c4b/attachment.html>
More information about the swift-evolution
mailing list