Xcode-beta (7A120f): Access controls are simply way too verbose

Originator:owensd
Number:rdar://21461229 Date Originated:19-Jun-2015 09:09 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-beta (7A120f)
Classification:Enhancement Reproducible:Always
 
Access control annotations are far too verbose and require too much effort to maintain, modify, promote, and demote through the lifecycle of coding.

public struct Token {
    public let token: Character
    public let content: String
    
    public let column: Int
    public let line: Int
}

Number of characters = 143 (or 343 if I include the required init() as the generated one is internal).

struct Token {
   let token: Character
   let content: String
    
   let column: Int
   let line: Int
}

Number of characters = 104

That’s nearly 30% of the code is just for “public”. 

The “workaround” for this is online all of your decls:

    public let token: Character,
        content: String,
        column: Int,
        line: Int

Or on a single line:

    public let token: Character, content: String, column: Int, line: Int

That’s just terrible and does not scale past the most trivial of types. C++ does a much better job here when handling member access control:

public struct Token {
public:
   let token: Character
   let content: String
    
   let column: Int
   let line: Int
}

We need something better.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!