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

2016-06-12 Thread Adrian Zubarev via swift-evolution
What is the status for this idea? I can’t find the proposal for this. :( --  Adrian Zubarev Sent with Airmail ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution

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

2016-05-06 Thread Adrian Zubarev via swift-evolution
+1 I can’t wait for Swift 3 anymore. This ability would be great. Additionally what do you think about something like this? protocol DelegatableType {      protocol Delegate: class // enforced you to create a nested protocol      weak var delegate: Delegate? // or Self.Delegate? }  class A:

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

2016-04-29 Thread Krishna Kumar via swift-evolution
Hey Brad +1 I think this will make delegate controller pattern a lot more clean and readable. I was thinking about other areas where this can be useful, and I thought it will be great for property injection from parent controller to children. class ParentController{ protocol Injection:

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

2016-04-28 Thread Brad Hilton via swift-evolution
You're right and since you can't nest any kind of type in a generic type right, that wouldn't work even with this proposal. However, in the generics manifesto they did say that they intend to remove that restriction. If they do lift the restriction, they may have to leave an exception in place for

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

2016-04-28 Thread Kurt Werle via swift-evolution
As a ruby programmer, I have to admit that I've tried to do this in Swift several times before remembering again that it isn't possible. +1 On Thu, Apr 28, 2016 at 3:44 PM, Howard Lovatt via swift-evolution < swift-evolution@swift.org> wrote: > +1 very handy to associate types together > > > On

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

2016-04-28 Thread Howard Lovatt via swift-evolution
To get over issues like the inner protocol accessing outer quantities like properties and generics you could add keyword noaccess (bike-shedding name) to the declaration to make it clear that it does not have access, e.g.: class MyController { noaccess protocol Delegate { // No access to T

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

2016-04-28 Thread Douglas Gregor via swift-evolution
> On Apr 28, 2016, at 10:15 AM, Brad Hilton via swift-evolution > wrote: > > Type nesting allows some convenient and straightforward semantics that we see > inside the Swift standard library such as views on String like > String.CharacterView,

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

2016-04-28 Thread Howard Lovatt via swift-evolution
+1 very handy to associate types together On Friday, 29 April 2016, Michael Peternell via swift-evolution < swift-evolution@swift.org> wrote: > I think that would be a good feature. > > > Am 28.04.2016 um 19:15 schrieb Brad Hilton via swift-evolution < > swift-evolution@swift.org

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

2016-04-28 Thread Michael Peternell via swift-evolution
I think that would be a good feature. > Am 28.04.2016 um 19:15 schrieb Brad Hilton via swift-evolution > : > > Type nesting allows some convenient and straightforward semantics that we see > inside the Swift standard library such as views on String like >

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

2016-04-28 Thread Brad Hilton via swift-evolution
Type nesting allows some convenient and straightforward semantics that we see inside the Swift standard library such as views on String like String.CharacterView, String.UnicodeScalarView, etc. However a protocol cannot be nested in a type and gives a non-obvious error that the “Declaration is