[swift-dev] Array with associatedtype protocol pattern

Karl razielim at gmail.com
Fri Jul 15 02:47:24 CDT 2016


> On 13 Jul 2016, at 20:23, 4 bottiglie g via swift-dev <swift-dev at swift.org> wrote:
> 
> Hi, i have asked the same question :
> Here: https://forums.developer.apple.com/message/153781#153781 <https://forums.developer.apple.com/message/153781#153781>
> And here : http://stackoverflow.com/questions/38281800/array-with-associatedtype-protocol <http://stackoverflow.com/questions/38281800/array-with-associatedtype-protocol>
> 
> But it seams like swift doesn’t have generic protocols arrays. I am asking here as a last resource if it can be done yet or there is a better design. 
> 
> 
> Regards, 
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev


I believe it's on the roadmap, but won’t make Swift 3.

See the Generics Manifesto: https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md

When I read it before, I seem to remember it explicitly called out having an Array of Equatable as an example of something which should be allowed. I can’t see it there now, but I think it’s still the intention that it works some day.

Karl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160715/cbce9f59/attachment.html>


More information about the swift-dev mailing list