[swift-evolution] [Opinion] Thoughts about the SE-0025 (Scoped Access Level) proposal
Vanderlei Martinelli
vmartinelli at alecrim.com
Sun May 8 15:13:37 CDT 2016
Hello.
I had a health problem and recently I needed a surgery because of it. Now
I'm fine (yay!), but I missed all the discussions and threads at this time.
Reading the SE-0025 proposal, which I find quite valid, I found it the
(ugly) keyword `fileprivate` and the lack of a `protected` scope. I know it
should be late for you to turn back, but below is my suggestion about the
access level scopes the Swift language could implement:
*public*
Nothing to change. Symbols will be visible to the CONTAINING TYPE and ALL
MODULES.
*protected **
Symbols visibility will be limited to the CONTAINING TYPE and DERIVED TYPES
from the containing type. (Rookies calling `myView.layoutSubviews()` no
more...)
*internal*
Nothing to change. Symbols will be visible to the CONTAINING TYPE and the
CURRENT MODULE.
*protected internal ****
Symbols visibility will be limited to the CONTAINING TYPE and DERIVED TYPES
from the containing type or the CURRENT MODULE. (They will be `protected`
when used by other modules, but `internal` when used by the current module.)
*private*
The symbols will be visible within the CONTAINING TYPE and the OTHER TYPES
in the SAME FILE. (This is the `fileprivate` proposed in SE-0025.)
*local ****
The symbols will be visible within the CONTAINING TYPE ONLY. (No other
types accessing my variables anymore... This is the proposed `private`in
SE-0025)
*The items marked with * denote new access levels. The other remain as they
are implemented in Swift 2.x*
Well... That was it.
Regards,
Vanderlei Martinelli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160508/9b3a1e57/attachment.html>
More information about the swift-evolution
mailing list