> I am now absolutely thrilled to create a filter to Mark As Read anything else 
> arising from this thread. Good luck.

That might be a good idea — after more than 200 messages, and a quite circular 
discussion with an unhealthy amount of ignorance for the opposing side ;-).

To fight the latter, I just tried to take the position that "new private" is 
really important, and this imho leads to interesting consequences...
This access modifier really doesn't solve a problem, like "let" does (unless 
the problem you want to solve is having a language with private access).
Have a look at this:

public struct SeperateConcerns {
        private var foo: Int = 0
        public mutating func updateFoo(_ value: Int) {
                print("The only allowed way to change foo was invoked")
                foo = value
        }

        private var bar: Int = 0
        public mutating func updateBar(_ value: Int) {
                print("The only allowed way to change bar was invoked")
                bar = value
        }

        private var foobar: Int = 0
        public mutating func updateFoobar(_ value: Int) {
                print("The only allowed way to change foobar was invoked")
                foobar = value
        }
}

You can protect foo from being changed by code in other files, and from 
extensions in the same file — and if the latter is a concern, there should also 
be a way to limit access to foo to specific function in scope.
Afaik, somebody proposed "partial" type declarations, but without them, the 
meaning of private is rather arbitrary, and the feature is only useful for a 
tiny special case.
If we had partial types, the situation would be different, and if would be 
possible to declare extensions inside a partial declaration of another type, we 
could even remove fileprivate without an replacement (I guess I should write a 
separate mail for this thought…)
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to