[swift-evolution] Type-based ‘private’ access within a file
matthew at anandabits.com
Fri Apr 7 10:23:40 CDT 2017
> On Apr 7, 2017, at 10:06 AM, BJ Homer via swift-evolution <swift-evolution at swift.org> wrote:
>> It does not remove the scoped access control, it only relaxes it in extensions to types in the same file.
> Many of the use cases for scoped access given during the review of SE-0159 specifically related to restricting access between extensions in the same file. I don't personally use this, but it seems it is definitely used by some developers.
The most common thing is to have some stored properties that are private and include a handful of fileprivate (or higher) methods that operate on these properties in the type declaration. All members that don’t need direct access to these properties are placed in extensions specifically to prevent the direct access to stored properties which they don’t need. This minimizes the lines of code with access to such properties.
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution