[swift-evolution] [Review] Replace `typealias` keyword with `associatedtype` for associated type declarations

Brent Royal-Gordon brent at architechies.com
Sun Jan 3 01:04:41 CST 2016


> 	* What is your evaluation of the proposal?

I think it's a great idea. The shift in meaning when you use `typealias` in a protocol is enormous—not only is an associated type far more different from a typealias than most protocol requirements, but it also changes the way you can use the protocol itself—and sharing a keyword gives you no hint of that. It also means that you can't search the documentation for the keyword to understand what it means. Switching to an `associatedtype` keyword fixes these issues.

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

Absolutely. I have seen nothing but confusion surrounding the use of associated types in protocols, and anything that might clear that up is a great idea.

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

Yes. Swift typically doesn't shy away from introducing new keywords to accurately capture semantics, and that's what `associatedtype` does.

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

I have not used any such languages.

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

I've participated in some of the discussions of this proposal, particularly the discussion of alternative keywords. There I advocated `associated`, but I will admit that `associatedtype` is slightly clearer.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list