<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 30, 2017, at 4:31 PM, Mike Kluev <<a href="mailto:mike.kluev@gmail.com" class="">mike.kluev@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">On 30 October 2017 at 23:14, Adam Kemp <span dir="ltr" class=""><<a href="mailto:adam_kemp@apple.com" target="_blank" class="">adam_kemp@apple.com</a>></span> wrote:<br class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br class="">
> On Oct 30, 2017, at 4:10 PM, Mike Kluev <<a href="mailto:mike.kluev@gmail.com" class="">mike.kluev@gmail.com</a>> wrote:<br class="">
><br class="">
> "classprivate" helps to resolve this problem. if it is marked so developer will at least think twice before making an extension to use it<br class="">
<br class="">
</span>Why would they think twice, though? You’ve told them extensions can use it, and they’ve written an extension to use it. What did they do wrong? I don’t think the rules are nearly as clear as for protected.<br class=""></blockquote><div class=""><br class=""></div><div class="">this is obvious: when they are writing a method in their own class and try to call: some.foo() it will give them and access level error (or even before that the autocomplete will not work as an early hint),</div></div></div></div></div></blockquote><div><br class=""></div><div><br class=""></div><div>This is not the situation I was asking about. I was asking why would someone in a random file who is about to write an extension think twice about using this method? He wouldn’t, because you’ve told him using that method (in an extension) is fine. But you may not know about or approve of that code he’s writing, and you may later make a change that breaks that usage. The access level has not improved your ability to reason about what might break.</div><div><br class=""></div><div>The root of our disagreement is in how we view extensions. There’s no real difference between code in an extension and code in some other class/struct/whatever. It’s still a client of the original class, not part of that class itself. It’s a separate thing. You’re thinking of an extension as part of the original class, but it’s not. Since anyone can write an extension, even in other modules, it has to be thought of as a separate thing, an external client. The author of the class has no control over or knowledge of extensions on that class, and the only way to be able to reason about whether a change to an API is safe is to use access levels that tell the author which files might be able to use that API.</div></div></body></html>