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

Derrick Ho wh1pch81n at gmail.com
Sun Jan 8 01:37:18 CST 2017


I think pattern matching is the most compelling reason to keep tuples.

If they were gone, how would we replace the following?

switch (a, b) {
case (value1, value2):
case (value3, value4):
}
On Sun, Jan 8, 2017 at 2:31 AM Derrick Ho <wh1pch81n at gmail.com> wrote:

> Don't remove tuples.
> They make it very convenient to pass multiple values around.
>
> Tuples use .0 instead of [0] which prevents any index out of bounds issues
> at compile time rather than at run time.
>
> Tuples should not adopt a dictionary style access because dictionaries
> imply nil for any key that doesn't exist in the dictionary. Tuples syntax
> prevents you from using non-existent keys.
>
>
> On Sun, Jan 8, 2017 at 1:51 AM David Sweeris via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>
>
> > On Jan 7, 2017, at 19:34, Freak Show <freakshow42 at mac.com> wrote:
> >
> > I think you're missing the forrest for the trees here.'
> >
> > Let me ask this:  if you remove tuples from the language - what have you
> lost - really?  You can still say everything you could before.
>
> A really convenient way to pass around multiple values without having to
> bother with a formal struct.
>
> - Dave Sweeris
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170108/9a5c8894/attachment.html>


More information about the swift-evolution mailing list