[swift-evolution] Swift 3 Generics

David Waite david at alkaline-solutions.com
Thu Dec 17 02:37:22 CST 2015

> On Dec 15, 2015, at 9:45 PM, Douglas Gregor via swift-evolution <swift-evolution at swift.org> wrote:
> This is something like:
>   extension CollectionType : Equatable where Generator.Element : Equatable {}
> This is probably not a priority for Swift 3. It seems very cool, and I've advocated for similar features in the past (in more static generics systems), but the potential for ambiguities with such definitions is very high and the runtime cost for asking questions such as "is this T Equatable?" can be very high when this feature is in play. 

I’m not sure about the runtime cost of non-“existential" protocols like Equatable, which can’t be casted to at runtime today. Of course, this makes that there are multiple ‘kinds’ of protocols with different usage that are declared in the same way more complex than it is today.


More information about the swift-evolution mailing list