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

Marc Knaup marc at knaup.koeln
Sun Dec 13 17:55:21 CST 2015


Hey guys,

I'm looking at Swift 3.0's goal to improve generics.

Is there any info yet if and how we will be able to refer to instances of
protocols that have associated types?
What is the difficulty in supporting this?

Simple examples:
var list = [Hashable]()
var hashable: Hashable = 2

Right now all we get is

> protocol 'Hashable' can only be used as a generic constraint because it
> has Self or associated type requirements


Thanks,
  Marc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151214/fa686efe/attachment.html>


More information about the swift-evolution mailing list