[swift-evolution] [Review] SE-0025 Scoped Access Level

Vanderlei Martinelli vmartinelli at alecrim.com
Fri Feb 26 19:52:15 CST 2016


+1 for the local scope.

-Van

On Fri, Feb 26, 2016 at 10:44 PM, Dany St-Amant via swift-evolution <
swift-evolution at swift.org> wrote:

>
> Le 26 févr. 2016 à 14:05, Douglas Gregor via swift-evolution <
> swift-evolution at swift.org> a écrit :
>
> The review of SE-0025 “Scoped Access Level" begins now and runs through
> March 3, 2016. The proposal is available here:
>
>
> https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md
>
>
> One good thing which is not fully highlighted in the proposal is when
> using nested classes, one can protect the guts of the inner class from the
> containing class. For completeness the local keyword would have to be
> useable to create local setter as well.
>
> class outer {
>     class counter {
>         local(set) var count: Int = 0 // Cannot set from outer
>         func incr() { count += 1 }
>     }
>     var data = counter()
>     func somework() { data.incr() }
> }
>
>
> Dany
>
> _______________________________________________
> 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/20160226/13e44f87/attachment.html>


More information about the swift-evolution mailing list