[swift-evolution] classprivate protection level?

Noah Desch deschnl at icloud.com
Mon Oct 30 19:36:41 CDT 2017



> On Oct 30, 2017, at 6:38 PM, Adam Kemp via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> 
>> On Oct 30, 2017, at 2:23 PM, Mike Kluev <mike.kluev at gmail.com> wrote:
>> 
>> On 30 October 2017 at 19:49, Adam Kemp <adam_kemp at apple.com> wrote:
>>  
>> How do you know there’s not an extension in this file without looking? If you don’t know then you have to check. That puts it in the same bucket as internal or public. The set of files you have to search through for usages is the same.
>> 
>> 
>> I'd just search for "extension SomeClass", Xcode search result window will list all files that have it.
>> or I will list all the users of "foo" if that's the one I am changing.
> 
> When you do that search, which files do you include in the search? That’s the key.


If I’m concerned with how much work I’ll have to do, no that’s not the key. The key is how many files do I have to read myself (only those containing a subclass or extension of my base class). You seem to be conflating a near instantaneous search in an IDE with manually evaluating a change’s impact to other source files in the module. “Classprivate" makes significantly fewer files that I have to manually review compared to “internal”.



>> the good guideline from Obj-C was (and still is) using "SomeClass+ExtensionName" file naming convention that also helps.
> 
> That’s not sufficient because there’s nothing in the language that would force people to follow this convention, and you can have extensions in any file for any class.


There doesn’t need to be anything in the language, I just need to have a defined coding convention that contributors follow. As someone else said upthread you have to be able to trust your fellow developers.

-Noah


More information about the swift-evolution mailing list