[swift-evolution] [RFC] Associated type inference
dgregor at apple.com
Fri Dec 1 13:19:05 CST 2017
> On Dec 1, 2017, at 10:07 AM, Greg Titus <greg at omnigroup.com> wrote:
>> On Dec 1, 2017, at 9:11 AM, Ben Langmuir via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> Hey Doug,
>> I'm very much in favour of reducing the scope of associated type inference. Can you outline why you believe that (3) is necessary? If I am following correctly, if we had (1) and (2) the only thing you'd need to add to the "minimal collection" implementation would be a typealias for `Element`, which seems reasonable to me.
> If nothing else, dropping (3) would be source breaking for 90%+ of current associated type uses. Whereas even the very minimal inference in (3) probably brings that figure down to 1% or so (outside of the stdlib, which would need to adopt a bunch of (2)). Obviously these percentages are just my guesses and not based on any real survey, but certainly would be the case for all Swift code I’ve seen.
Many of the associated-type inference bugs I’ve seen were from people expecting something like (3), but the current implementation either fails to infer anything (the common case!) or we get inference from some seemingly-unrelated place. I included (3) specifically because I think taking away (3) will break source compatibility significantly (as Greg suggests)… and despite the fact that the complexity of implementation for (3) is fairly high.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution