[swift-evolution] Revisiting SE-0110

Chris Lattner sabre at nondot.org
Sat Jun 17 11:47:44 CDT 2017


> On Jun 15, 2017, at 4:55 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
>>> 
>>> Agreed, it may be too late to correct this (certainly we can't outright remove it in Swift 4 if someone is using it for something important).  However if it turns out that it really isn't used, then warning about it in 4 and removing it shortly after may be possible.
>> 
>> And I think its difficult to make the parallel between the two. SE-0110 basically impacted everybody calling higher-order functions on Dictionary (+ more users from libraries like RxSwift), which makes an enormous proportion of the Swift community. On the other hand, despite the enormous amount of time I have sinked into learning, discussing and enjoying Swift, I never come upon the tuple element name syntax in patterns until Robert pointed to it out on twitter several weeks ago.
> 
> By the way, I’m not attempting to deduce that nobody uses this feature by the fact I didn’t know about it. But I think it’s one interesting datapoint when comparing it to SE-0110.
> 
> 
> SE-0110, **in retrospect**, has had impacts on a lot of users; prospectively, it was thought to be a minor change, even after review and acceptance.
> 
> Keep in mind that this proposed change would also eliminate inline tuple shuffle. For instance, the following code will cease to compile:
> 
> let x = (a: 1.0, r: 0.5, g: 0.5, b: 0.5)
> func f(color: (r: Double, g: Double, b: Double, a: Double)) {
>   print(color)
> }
> f(color: x)
> 
> It is an open question how frequently this is used. But like implicit tuple destructuring, it currently Just Works(TM) and users may not realize they’re making use of the feature until it’s gone.
> 

To (re)clarify, I was just talking about removing tuple element names from the tuple pattern grammar.  This example doesn’t use tuple patterns, so it wouldn’t be affected.  I’m not proposing removing tuple shuffles.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170617/0210aefe/attachment.html>


More information about the swift-evolution mailing list