[swift-evolution] Proposal for generic protocols

Joe Groff jgroff at apple.com
Thu Dec 3 20:19:22 CST 2015

> On Dec 3, 2015, at 6:10 PM, Tal Atlas <me at tal.by> wrote:
> Thanks for the great info. I made this because I didn't see anything on the current plan and I really hope that whatever comes out has the power and ease of the proposal. 
> Thanks again for the great responses. 

No problem, thank you for writing this up! If you want to think about this more, some things you might consider:

- What changes would be necessary to the standard library to make the most of this feature? Some particular problems we'd like to solve are to eliminate the need for the AnyGenerator/AnySequence/AnyCollection wrapper types, and to provide a solution for heterogeneous equality, so that protocols can inherit Equatable and Hashable without forfeiting the ability to be used dynamically. See Brent Simmons' Swift diary posts at http://inessential.com/swiftdiary for an example of why the latter is important.
- A hybrid approach that allows for both generic parameters and associated types like Rust, as Kevin pointed out, or one where generic parameters are sugar for associated types, might be worth considering.

Thanks again!


More information about the swift-evolution mailing list