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

Dany St-Amant dsa.mls at icloud.com
Fri Feb 26 19:44:05 CST 2016

> 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 <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() }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160226/9d8875a2/attachment.html>

More information about the swift-evolution mailing list