[Pitch] Allow nested protocol declarations


(Adrian Zubarev) #1

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

···

--
Adrian Zubarev
Sent with Airmail


(Adrian Zubarev) #2

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. :slight_smile:

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@devandartist.com) schrieb:

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

--
Adrian Zubarev
Sent with Airmail