[swift-evolution] access control proposal

Ilya Belenkiy ilya.belenkiy at gmail.com
Mon Dec 14 06:16:03 CST 2015


These are very nice refinements if we set a goal to make those scenarios
work. I think that they they would just need to be refactored though. If
the access level is so convoluted, there is something wrong with the API.

--
Ilya Belenkiy

On Sun, Dec 13, 2015 at 6:53 PM Matthew Johnson via swift-evolution <
swift-evolution at swift.org> wrote:

>
> I don’t think these are troll proposals. They *are* a little more limited,
> a little more esoteric, but you could say the same thing about `local` vs.
> `private`. And in some cases you can emulate some of these with the four
> access modifiers you want, but again, you could say the same thing about
> `local` vs. `private`.
>
>
> You're right.  Your examples have convinced me of this point.  There exist
> non-troll proposals for further access modifiers.
>
>
> There are definitely further refinements to access control that could be
> desired.  I have given them some thought as this thread has proceeded.
> There would be ways to accommodate them through refinement of the 'scope'
> access level.
>
> For example, we could allow a syntactic 'scope {}' block which would be
> transparent for all purposes except introducing a scope for access
> control.  We could also allow labeled scopes and allow the 'scope' access
> control level to specify a label, for example to allow an inner type to
> expose scoped members to the outer type but not other code in the same file.
>
> While this potential exists I think it introduces complexity that is
> probably not worth it.  I am only mentioning these ideas to demonstrate
> that a 'scope' access modifier is something that can be refined to provide
> more control if enough compelling use cases were identified.  We wouldn't
> need to add entirely new access modifiers to address such use cases.
>
> Matthew
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151214/bc6c7adb/attachment.html>


More information about the swift-evolution mailing list