> On Jun 29, 2016, at 6:55 AM, Brandon Knope via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> What's the rationale for having associatedtype in protocols and typealias in 
> the conforming types?

I didn't design it, but here's how I think about it: The associated type 
requirement merely states that there must be a type with this name meeting 
these criteria. `typealias` is one way to satisfy that requirement, but you can 
also just define a nested type with that name:

        struct MyCollection {
                struct Index: Comparable { … }
        }

Should you replace `struct` with `associatedtype`? No? Then why would you 
replace `typealias` with `associatedtype`?

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to