[swift-evolution] protocol can only be used as a generic constraint because it has Self or associated type requirements

Dave Abrahams dabrahams at apple.com
Mon Dec 14 09:40:21 CST 2015


> On Dec 14, 2015, at 6:23 AM, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
> 
> It is definitely possible to solve this problem for associated types by binding or constraining them.  The ML module system has a feature that is roughly analogous to this.  

Keep in mind that a language feature like binding/constraining associated types is not a complete solution for real use-cases, so we would still need AnySequence<Element> in the library.  Otherwise it would be SequenceType<Generator: SomeGenerator>, which binds a type that you don't actually want to expose.

-Dave



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151214/3c8ebb0f/attachment.html>


More information about the swift-evolution mailing list