[swift-evolution] [Proposal][Discussion] Deprecate Tuple Shuffles

Haravikk swift-evolution at haravikk.me
Fri May 5 04:48:31 CDT 2017


I have to admit I've become confused by what exactly this proposal is trying to fix as there's a lot of talk about removing labels entirely or something? I'm very wary about that.

> On 5 May 2017, at 03:14, Robert Widmann via swift-evolution <swift-evolution at swift.org> wrote:
> 
> let a = (x: 1, y: 2)
> var b: (y: Int, x: Int)
> b = a
However, for this specific case above I do agree that a warning should be added, as the implicit behaviour here could all too easily be a mistake. I would prefer instead the developers either manually reorder the values, and perhaps that an operator be added to explicitly perform automatic reordering. Perhaps a tilde? Like so:

	let a = (x: 1, y: 2)
	var b: (y:Int, x:Int)

	b = a // warning
	b = (x: a.x, y: a.y) // explicit, manual reordering
	b = ~a // implicit, automatic reordering by label matching (still warns/errors on type mismatch)

As for any other changes however, I think these should be addressed in their own proposals as I think discussion is getting too broad and confusing IMO.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170505/55ff3e14/attachment.html>


More information about the swift-evolution mailing list