[swift-evolution] [Discussion] Allowing extending existentials
David Hart
david at hartbit.com
Wed Feb 22 00:53:37 CST 2017
Hello list,
Found out yesterday that you can’t extend all existentials in Swift:
protocol P1 {}
extension P1 {}
// works as expected
protocol P2 {}
extension P1 & P2 {}
// error: non-nominal type 'P1 & P2' cannot be extended
extension Any {}
// error: non-nominal type 'Any' cannot be extended
extension AnyObject {}
// error: 'AnyObject' protocol cannot be extended
I’d like to write a proposal to lift some of those restrictions. But the question is: which should be lifted? P1 & P2 seems like an obvious case. But what about Any and AnyObject? Is there a design reason that we shouldn’t allow it?
David.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170222/cb7ee302/attachment.html>
More information about the swift-evolution
mailing list