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

Matt Whiteside mwhiteside.dev at gmail.com
Sun Jan 3 13:15:46 CST 2016

I have one concern with `associated` vs `associatedtype`, which is that it people might, in the interest of clarity, start naming things using a conventions like

`associated PayloadType`, 

when I think it would be better to have  

`associatedtype Payload`

because it leaves less room for interpretation about how to name things idiomatically.

But I still haven’t completely decided between `type` and `associatedtype`, and I plan to respond to this thread separately with my thoughts on that.


> On Jan 3, 2016, at 10:10, Alex Migicovsky via swift-evolution <swift-evolution at swift.org> wrote:
>> * What is your evaluation of the proposal?
> I think the proposal is great. The only thing I’d prefer is to use `associated` over `associatedtype`.
> `associated` has always felt better to me over `associatedtype`. It was mentioned in one of the original proposals as the keyword that was initially most well received as well—I think this is because it just feels right, which is a good indicator even though it doesn’t seem scientific :-)
> One downside mentioned is that `associated` is more vague than `associatedtype`, but there’s a reason why we don’t have `protocoltype`, `classtype`, etc as keywords over `protocol` and `class`. I think the convention of having associated type names start with an uppercase letter makes it clear that what follows `associated` is a type (or will be a concrete type).
>> * Is the problem being addressed significant enough to warrant a change to Swift?
> Yes, I’ve seen many developers be confused by the difference between defining a typealias inside a protocol declaration vs outside.
>> * Does this proposal fit well with the feel and direction of Swift?
> Yes.
>> * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
> I’ve been paying attention to the thread and have thought about why I like `associated` over `associatedtype` since the start of the thread.
> - Alex
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

More information about the swift-evolution mailing list