> On May 30, 2016, at 2:02 PM, Tino Heth <[email protected]> wrote:
> 
>> The purpose of access control isn’t really to keep out malicious users, 
>> though, it’s to prevent accidental misuse and clarify the interface.
> mh, I would call this a "documenting intend" ;-)

If you get the method as an autocomplete, you won’t see the documentation 
telling you not to use it.

>> One nice vector for accidental misuse is autocomplete. Even if 
>> layoutSubviews() has a great big // DON’T USE!!! in the documentation, it’s 
>> possible that someone is trying to remember the name of the API they need to 
>> use to tell the OS something needs to update its layout, so they type 
>> “layout” into the code editor, and lo and behold! Here’s something called 
>> layoutSubviews() that sounds like the sort of thing we want. And so it goes. 
>> A protected modifier in the language would prevent things like this.
> true — but even subclasses shouldn't call layoutSubviews unregulated, so I 
> think this is a flawed example for the usefulness of protected.


This is why I prefer fileprivate(call) over protected.

Charles

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to