> The purpose of access control isn’t really to keep out malicious users,
> though, it’s to prevent accidental misuse and clarify the interface.
mh, I would call this a "documenting intend" ;-)
> One nice vector for accidental misuse is autocomplete. Even if
> layoutSubviews() has a great big // DON’T USE!!! in the documentation, it’s
> possible that someone is trying to remember the name of the API they need to
> use to tell the OS something needs to update its layout, so they type
> “layout” into the code editor, and lo and behold! Here’s something called
> layoutSubviews() that sounds like the sort of thing we want. And so it goes.
> A protected modifier in the language would prevent things like this.
true — but even subclasses shouldn't call layoutSubviews unregulated, so I
think this is a flawed example for the usefulness of protected.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution