[swift-evolution] Simplifying Access Using 'Hidden'
Karl Wagner
razielim at gmail.com
Mon Feb 13 10:35:39 CST 2017
> On 13 Feb 2017, at 17:21, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:
>
> People talk always like “I never liked fileprivate” and I feel like some of you forgot that fileprivate is not new to Swift. It’s the repainted private from days before Swift 3. I cannot recall anyone complaining about it that much. There were some people that forced the addition of a stricter private access modifier for Swift 3. Now that we have both, there are a lot of complains about fileprivate.
>
>
It _is_ kind of ugly. I would support rearranging our access lives like this, with a parameterised “private”:
open
public
private(module) // today’s “internal”
private(file) // today’s “fileprivate”
private // today’s “private”
It also opens the door to more nuanced access levels, such as private(type) to allow access to the hidden member in cross-file extensions but not generally throughout the module.
For properties, it would mean
public internal(set) var something: Bool
would become
public private(module, set) var something: Bool
at which point it might be nicer to flip the arguments and call it “setter”:
public private(setter, module) var something: Bool
- Karl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170213/6c0822f5/attachment.html>
More information about the swift-evolution
mailing list