[swift-evolution] Will existentials ever conform to their protocols?
Braeden Profile
jhaezhyr12 at gmail.com
Tue Jan 17 22:30:01 CST 2017
Hello Swift Community!
I know that I’ve seen this mentioned before, but what with Enhanced Existentials being brought up, I think this is worth mentioning now. What is the plan regarding letting existentials conform to their protocols? Currently, in Swift 3, it is impossible to write code like this:
protocol Updatable
{ func update() }
struct UpdatePool<T: Updatable>
{ /* ... */ }
let heterogenousPool = UpdatePool<Updatable>()
Error on the last line: “Using ‘Updatable’ as a concrete type conforming to protocol ‘Updatable’ is not supported.”
Although my most common use case of this behavior has actually been solved (using ‘AnyObject’ as a concrete type conforming to ‘AnyObject’), I wonder why this can’t be extended to any protocol existential (a field which is about to explode, if we succeed in Enhancing them).
What do you guys think?
—Braeden Hintze
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170117/e347ed5a/attachment.html>
More information about the swift-evolution
mailing list