[swift-evolution] [Post Swift 3] [Proposal] Introducing `group` mechanism

Adrian Zubarev adrian.zubarev at devandartist.com
Thu Jun 30 15:14:36 CDT 2016


How about adding attributes on extensions (just bikeshedding), because to me it’s not clear if you’re creating a class/static access label or for an instance of that type?

Nesting extensions would become useful for the sake of access labels.

struct A {
     
    public extension Self.foo {
        func someMethod() { … } // a.foo.someMethod()
    }    
     
    private extension Self.foo.bar {
        func someHiddenMethod() { … } // a.foo.bar.someHiddenMethod()  
    }
}

// Or
struct A {
     
    public extension self foo {
        func someMethod() { … } // a.foo.someMethod()
    }    
     
    private extension self.foo bar {
        func someHiddenMethod() { … } // a.foo.bar.someHiddenMethod()  
    }
}
The only problem I have with extensions, that they don’t read that well and personally I don’t like the default access modifier on them (not how its done right now).

Thank you for providing new ideas. :)



-- 
Adrian Zubarev
Sent with Airmail

Am 30. Juni 2016 um 21:57:37, Haravikk (swift-evolution at haravikk.me) schrieb:

struct A {}
public extension A.foo {
func someMethod() { … } // a.foo.someMethod()
}
private extension A.foo.bar {
func someHiddenMethod() { … } // a.foo.bar.someHiddenMethod() 
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160630/34224d99/attachment.html>


More information about the swift-evolution mailing list