[swift-evolution] [swift-evolution-announce] [Review] SE-0108: Remove associated type inference

Matthew Johnson matthew at anandabits.com
Wed Jun 29 20:51:28 CDT 2016

> 	* What is your evaluation of the proposal?

I’m going to stay neutral.  The motivation is implementation focused and I am not qualified to adequately assess it.

It does sound like it might be necessary to do this (at least temporarily) in order to facilitate evolution of other generics features.  However, as I stated in the discussion, I do consider it unfortunate.  The language has this feature for a good reason and that hasn’t changed.  If we do remove this feature we should be very certain that it is necessary.

> 	* Is the problem being addressed significant enough to warrant a change to Swift?

It sounds like the implementation complexities are significant enough to warrant a change.  I trust the core team to asses that.  

If it weren’t for implementation considerations I wouldn’t believe there is a problem.  I think associated type inference is a particularly elegant feature, not a problem.

> 	* Does this proposal fit well with the feel and direction of Swift?

I suppose it does in the sense that a major them of Swift 3 is to clean up areas of the language that didn’t work out as hoped or intended.

> 	* If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

I have not actively used them in real projects, but I have spent significant time studying functional languages where inference is a hallmark feature.  Inference can be an extremely elegant feature.  It can also be pushed too far when it can hinder clarity and readability.  

Swift attempts to strike a careful balance here and does a pretty good job of it.  However, there is *no* case where I think Swift takes inference too far (in terms of impact on clarity and readability), including associated type inference.  Reducing Swift’s inference capabilities feels like a step backwards to me.  I believe associated type inference *increases* clarity and readability.  

It’s worth pointing out that manually providing associated type bindings is valid in Swift today, yet it is rare to do so explicitly using a typealias when implementing a conformance.  I believe this is anecdotal evidence that the community generally finds that leaning on inference of associated types *increases* clarity and readability and values this feature. 

> 	* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

Careful consideration of the implementation issues, the proposed solution, and the impact on users of the language.

> More information about the Swift evolution process is available at
> 	https://github.com/apple/swift-evolution/blob/master/process.md
> Thank you,
> -Chris Lattner
> Review Manager
> _______________________________________________
> swift-evolution-announce mailing list
> swift-evolution-announce at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution-announce

More information about the swift-evolution mailing list