[swift-evolution] [Proposal] Separate protocols and interfaces

David Waite david at alkaline-solutions.com
Sun Jan 3 10:53:37 CST 2016


I like this, and had considered proposing something similar.

Points:
I would have chose to leave protocol to mean the dynamically dispatch-able type declaration, as that is what it indicates in Objective-C. Your proposal would cause every Objective-C protocol to now be considered an interface in Swift terms.

Some discussion on this list makes me think that you might instead have a modifier for declaring statically dispatched, existential protocols - e.g. “existential protocol SequenceType { … }”

Also, note not all usage of Self need be disallowed in dynamically dispatch-able types today:

protocol Test { 
     func foo() -> Self 
}    

var t:Test? // legal, I assume on purpose due to the covariance of the return type

-DW

> On Jan 3, 2016, at 7:48 AM, Антон Жилин via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Introduction of interfaces will clean up the current blend of static and dynamic protocols, and solve at least three popular issues.
> Please see:
> https://github.com/Anton3/swift-evolution/blob/master/proposals/0000-introducing-interfaces.md <https://github.com/Anton3/swift-evolution/blob/master/proposals/0000-introducing-interfaces.md> _______________________________________________
> 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/20160103/2a1ab885/attachment.html>


More information about the swift-evolution mailing list