> 1. Methods and properties that only subclasses must access, but other code 
> has no business updating. An example of this UIGestureRecognizer. State 
> machine type access is something where external items should not access, but 
> internal state may require the rights to update.

But again, "external" does not necessarily mean "non-subclass", and "internal" 
does not necessarily mean "subclass". A particular subclass might not require 
access, and a helper type/function might require access.

This insight—that the type graph doesn't always reflect the boundaries of 
concerns—is the very basis of Swift's current access control design. It's the 
reason why `private` (soon to become `fileprivate`) doesn't grant visibility to 
extensions on the same type in different files, but *does* grant it to 
extensions on different types in the same file. This is an important innovation 
in Swift's access control design, and we shouldn't ignore it when we're 
thinking about `protected`.

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to