<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote type="cite" class="">On Mar 27, 2017, at 12:00 PM, Ross O'Brien via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></blockquote><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I'm considering this from a different angle.</span><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">When we declare a type, we declare properties and functions which that type has.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">When we extend a type, we add functions to the type. (I'm including computed properties in this.)</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">It's become an idiom of Swift to declare an extension to a type for each protocol we want it to conform to, for reasons of code organisation and readability. This may be true even if conformance to the protocol was a primary intent of creating the type in the first place.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""><div class="">The intent of the scoped access level is to allow programmers to create properties and functions which are limited to the scope of their declaration. A protocol conformance can be written, with the aid of helper functions, in the confidence that the helper functions are not visible outside the extension, minimising their impact on other components of the module.</div><div class="">However, some protocol conformances require the type to have a specific property, which the extension cannot facilitate. Some protocol conformances don't require a property, but it would be really useful to have one, and again an extension can't facilitate.</div><div class=""><br class=""></div><div class="">Example: we want to be able to write this, but we can't:</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">private</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>Bar</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>integer :<span class="Apple-converted-space"> </span></span><span style="color: rgb(112, 61, 170); font-variant-ligatures: no-common-ligatures;" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>{<span class="Apple-converted-space"> </span></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">get</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>increment()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">struct</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>Foo</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">extension</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Foo</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>:<span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Bar</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>integer :<span class="Apple-converted-space"> </span></span><span style="color: rgb(112, 61, 170); font-variant-ligatures: no-common-ligatures;" class="">Int</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">private</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>counter :<span class="Apple-converted-space"> </span></span><span style="color: rgb(112, 61, 170); font-variant-ligatures: no-common-ligatures;" class="">Int</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>increment()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="white-space: pre;" class=""> </span>{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="white-space: pre;" class=""> </span>counter +=<span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);" class="">1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="white-space: pre;" class=""> </span>}</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(186, 45, 162);" class=""></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div></div><div class=""><br class=""></div><div class="">This leads to a workaround: that properties are added to the original type, and declared as fileprivate. They're not intended to be visible to any scope other than the conforming extension - not even, really, to the type's original scope.</div><div class=""><br class=""></div><div class="">Continuing the example: we've compromised and written this:</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">private</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>Bar</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>integer :<span class="Apple-converted-space"> </span></span><span style="color: rgb(112, 61, 170); font-variant-ligatures: no-common-ligatures;" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>{<span class="Apple-converted-space"> </span></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">get</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>increment()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">struct</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>Foo</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><font class=""><span style="white-space: pre;" class=""> </span></font><font color="#ba2da2" class="">fileprivate</font></span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>integer :<span class="Apple-converted-space"> </span></span><span style="color: rgb(112, 61, 170); font-variant-ligatures: no-common-ligatures;" class="">Int</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><font class=""><span style="white-space: pre;" class=""> </span></font><font color="#ba2da2" class="">fileprivate</font></span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>counter :<span class="Apple-converted-space"> </span></span><span style="color: rgb(112, 61, 170); font-variant-ligatures: no-common-ligatures;" class="">Int</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">extension</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Foo</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>:<span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Bar</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>increment()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="white-space: pre;" class=""> </span>{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="white-space: pre;" class=""> </span>counter +=<span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);" class="">1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="white-space: pre;" class=""> </span>}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="" class="">}</span><br class=""></div></div><div class=""><br class=""></div><div class="">This is not a fault of <span style="color: rgb(186, 45, 162); font-family: menlo; font-size: 11px;" class="">fileprivate</span> (though it's a clunky name), or <span style="color: rgb(186, 45, 162); font-family: menlo; font-size: 11px;" class="">private</span>. Renaming these levels does not solve the problem. Removing private, such that everything becomes fileprivate, does not solve the problem. The problem is in the extension system.</div><div class="">(At this point I realise I'm focusing on one problem as if it's the only one.)</div><div class=""><br class=""></div><div class="">Supposing we approached extensions differently. I think around SE-0025 we were considering a 'nested' access level.</div><div class=""><br class=""></div><div class="">Supposing we created a 'conformance region' inside a type declaration - a scope nested within the type declaration scope - and that this conformance region had its own access level. It's inside the type declaration, not separate from it like an extension, so we can declare properties inside it. But literally the only properties and functions declared inside the region but visible anywhere outside of it, would be properties and functions declared in the named protocol being conformed to.</div><div class=""><br class=""></div><div class="">So, visually it might look like this:</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">private</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>Bar</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>integer :<span class="Apple-converted-space"> </span></span><span style="color: rgb(112, 61, 170); font-variant-ligatures: no-common-ligatures;" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>{<span class="Apple-converted-space"> </span></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">get</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>increment()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">struct</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>Foo</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="white-space: pre;" class=""> </span></span><span style="color: rgb(186, 45, 162);" class="">conformance</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> Bar<span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">// or conformance Foo : Bar, but since the region is inside Foo that's redundant</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="white-space: pre;" class=""> </span>{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>integer : Int<span class="Apple-converted-space"> </span></span><span style="color: rgb(0, 132, 0); font-variant-ligatures: no-common-ligatures;" class="">// visible because Foo : Bar, at Bar's access level</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>counter : Int =<span class="Apple-converted-space"> </span></span><span style="color: rgb(39, 42, 216); font-variant-ligatures: no-common-ligatures;" class="">0</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="color: rgb(0, 132, 0); font-variant-ligatures: no-common-ligatures;" class="">// only visible inside the conformance scope, because not declared in Bar</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; white-space: pre;" class=""><font class=""> </font></span><span style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>increment()<span class="Apple-converted-space"> </span></span><span style="color: rgb(0, 132, 0); font-variant-ligatures: no-common-ligatures;" class="">// visible because Foo : Bar, at Bar's access level</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="white-space: pre;" class=""> </span>{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="white-space: pre;" class=""> </span>counter +=<span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);" class="">1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="white-space: pre;" class=""> </span>}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="white-space: pre;" class=""> </span>}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div class="">I've introduced a new keyword, <span style="color: rgb(186, 45, 162); font-family: menlo; font-size: 11px;" class="">conformance</span>, though it may be clear enough to keep using <span style="color: rgb(186, 45, 162); font-family: menlo; font-size: 11px;" class="">extension</span> inside a scope for this. Foo still conforms to Bar, in the same file. We've removed 'extension Foo :' and moved a '}' for this, but that's not a breaking change as this is an addition. Readability is compromised to the extent that this conformance is indented one level.</div><div class=""><br class=""></div><div class="">I've not long had the idea. It's a different approach and may be worth a discussion thread of its own for - or someone might point out some glaringly obvious flaw in it. If it's useful, I don't know the full implications this would have, such as how much this would reduce the use of <span style="color: rgb(186, 45, 162); font-family: menlo; font-size: 11px;" class="">fileprivate</span> (e.g. to none, to the minimal levels expected in SE-0025, or no effect at all). It's just intended to remove a problem which <span style="color: rgb(186, 45, 162); font-family: menlo; font-size: 11px;" class="">fileprivate</span> is applied as a bad workaround for.</div></div></div></blockquote></div><br class=""><div class="">+1. Creates a mechanism that actually makes sense for what people are using ‘extension’ for, solves the scoping problems, eliminates the need for fileprivate, solves all the problems that people are complaining about.</div><div class=""><br class=""></div><div class="">You could also enforce it by disallowing a ‘conformance’ block from containing any non-private methods that don’t work towards implementing the protocol.</div><div class=""><br class=""></div><div class="">Charles</div><div class=""><br class=""></div></body></html>