[swift-evolution] Generalized Existentials / Type Erasers

David Hart david at hartbit.com
Tue Jan 31 06:27:38 CST 2017


Hi Chris,

The topic has been heavily discussed last year, culminating into a massing proposal by Austin Zheng:

https://github.com/austinzheng/swift-evolution/blob/az-existentials/proposals/XXXX-enhanced-existentials.md#nested-typealias-existential <https://github.com/austinzheng/swift-evolution/blob/az-existentials/proposals/XXXX-enhanced-existentials.md#nested-typealias-existential>

The proposal was never merged and postponed for a future Swift release. This feature is very important for me so I reopened it earlier this month:

https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170102/029890.html <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170102/029890.html>

Douglas Gregor replied to this thread saying that part of the proposal (superclass and protocol constraints) should be proposed and implemented for Swift 4, but that the remaining more generalised has little chance to make it in time for Swift 4.

In consequence, I started a new thread with the smaller feature of superclass and protocol constraints:

https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170123/031066.html <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170123/031066.html>

Quite a few comments have already been made about the proposal so I’ll post a new draft soon. But please let me know if you have more comments!

David.

> On 31 Jan 2017, at 11:07, Chris Eidhof via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Hi swift-evolution,
> 
> I was wondering if anything more detailed has been written about generalized existentials / type erasers. I noticed that AnyCollection only delegates a number of methods to its wrapped value, but often doesn't. For example, all the conditionally inherited items aren't being delegated (e.g. min()). This behavior was surprising to me (but makes sense once I thought about it longer).
> 
> How would this work with generalized existentials? Are generalized existentials in scope at all for Swift 4?
> 
> -- 
> Chris Eidhof
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170131/007bd776/attachment.html>


More information about the swift-evolution mailing list