[swift-evolution] [Pitch] Remove type inference for associated types

Chris Lattner clattner at apple.com
Tue Jun 28 22:50:38 CDT 2016


> On Jun 28, 2016, at 11:25 AM, Douglas Gregor via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> 
>> Finally, I am very concerned that there are protocols such as Collection,
>> with many inferrable associated types, and that conforming to these
>> protocols could become *much* uglier.
> 
> That’s the general concern I have as well: how much boilerplate does this add? In many cases, we get some of the associated type witnesses for Collection types for free, and I don’t know to what extent we can emulate that with defaulted associated type requirements and typealiases in protocol extensions.
> 
> That said, I’ll take some minor regressions in this area for the massive simplification that this proposal brings.

Another point to add to Doug’s great summary: instead of keeping it, it is better in many ways to remove this feature in Swift 3, improve the generics model throughout Swift 4 cycle, and then consider adding inference back when we know more.  

The benefits of adding it back will be even more clear in the future, and the implementation cost will also be more knowable as the rest of the generics system is baked out.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160628/18bae046/attachment.html>


More information about the swift-evolution mailing list