[swift-evolution] [Pitch] Allow nested protocol declarations

Adrian Zubarev adrian.zubarev at devandartist.com
Sun Jun 12 14:44:26 CDT 2016

If there is no proposal yet, I could write one. We should sketch out what we should consider for nested protocols. I’d love to see this feature in Swift 3. :)

Should this be allowed? I’m not sure what and what not we’ll see of generics in Swift 3.

// A<Int>.P1

class A<T> {
    protocol P1: class {}

// B<Int>.P2

class B<T> {}

extension B where T == Int {
    protocol P2: class {}
For non-generics its a welcome addition:

// C.P3

class C {
    protocol P3 {}
In my project I’d use this like TCP.Data.Convertible where Convertible is the protocol sitting on my Data type.

Adrian Zubarev
Sent with Airmail

Am 12. Juni 2016 um 15:13:41, Adrian Zubarev (adrian.zubarev at devandartist.com) schrieb:

What is the status for this idea? I can’t find the proposal for this. :(

Adrian Zubarev
Sent with Airmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160612/1f62a13a/attachment.html>

More information about the swift-evolution mailing list