> On May 28, 2016, at 8:11 PM, Brent Royal-Gordon via swift-evolution > <[email protected]> wrote: > > But `protected` is quite different from other access levels; it does not > limit the visibility of the symbols, but rather their use. And protocols face > the same sort of problem as classes, where certain members are essentially > override hooks and shouldn't be called directly outside a particular scope. > > So I think we ought to allow `accesslevel(call)`, but not a plain > `accesslevel`: > > public fileprivate(call) func layoutSubviews() > internal fileprivate(call) func privateSubclassingHook() > public internal(set: call) var x = 20 > internal(call) func protocolConformanceHook() > fileprivate(set: call) var onlyProtocolSetsThis: Int { get set }
Given that this is almost identical to the pitch I floated to the list some months ago, all the way down to the fileprivate(call) syntax (well, back then “fileprivate” was “private”, so it was private(call)), I’m +1 on this. > On May 29, 2016, at 6:55 PM, Brent Royal-Gordon via swift-evolution > <[email protected]> wrote: > > The thing is, though, the contents of the sharps drawer are *still* sharp > even if you're old enough to use a knife. And similarly, APIs like the > `state` setter are *still* dangerous even if you've subclassed > `UIGestureRecognizer`. To be sure, it is more likely that you'll *need* to > set `state`, but it's still not something you should do carelessly or without > understanding the consequences. This, though, reads like “The 17-year-old might cut himself with a knife, even though he *needs* the knives to help with the cooking. So, let’s give knives to the newborn!” Charles
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
