[swift-evolution] [Proposal][Discussion] Deprecate Tuple Shuffles
Rien at Balancingrock.nl
Fri May 5 03:31:36 CDT 2017
> On 05 May 2017, at 09:59, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> On Fri, May 5, 2017 at 2:56 AM, Rien <Rien at balancingrock.nl> wrote:
> > On 05 May 2017, at 09:31, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> > On Fri, May 5, 2017 at 2:28 AM, Adrian Zubarev <adrian.zubarev at devandartist.com> wrote:
> > I’m not arguing to remove all labels in Swift. Labels are great, this is a fact for sure. The point I was trying to make is that labels in tuples how either a meaning or not at all.
> > // This is a shortcut for the tuple type `(x: Int, y: Int)`
> > let foo = (x: 0, y: 0)
> > // In this case the labels are only used for description,
> > // they do not server any benefit here are most likely redundant
> > let (x: x, y: y) = foo
> > Labels elsewhere are a different story and I do support the cosmetic addition Chris Lattner sketched out here: https://lists.swift.org/pipermail/swift-evolution-announce/2016-July/000233.html
> > However this is about closures and not tuples, I don’t think this would anyhow affect the removal of labels in tuple destructuring.
> > Plus I don’t see this to create an inconsistent in Swift, because as I already said, labels in tuple destructuring are useless.
> > How come? I just illustrated their use. They help humans write correct code by allowing the compiler to check an assertion that the human knows which labels go with which positions in the tuple.
> True, but the ability to define your own labels (instead of the API developer defining them for you) can make your code more readable. and hence maintainable.
> I'm not sure I understand what you're suggesting here. Can you clarify?
In trying to explain, I discovered an error in my thinking… so please disregard.
(Btw: Thanks for asking!)
More information about the swift-evolution