<div dir="ltr"><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important">We really need a place for discussions that apply to deferred issues. Some previous suggestions from myself and others have been:</p>
<ul style="margin:1.2em 0px;padding-left:2em">
<li style="margin:0.5em 0px">A Discourse board</li>
<li style="margin:0.5em 0px">Tag emails [4.1] (or something else) if they are known to relate to deferred proposals.</li>
<li style="margin:0.5em 0px">A ‘deferred’ directory for complete proposals in the swift-evolution repo to give deferred topics more visibility and a central place for discussion around</li>
</ul>
<p style="margin:0px 0px 1.2em!important">Until then, I’ll just pile on…</p>
<p style="margin:0px 0px 1.2em!important">I’ve previously suggested an idea similar to this where a type can define its own named access groups and then use them for access control. I didn’t flesh it out in full (as this is a deferred topic anyway) but the concept was something along these lines…</p>
<p style="margin:0px 0px 1.2em!important">A class might define a group called <code style="font-size:1em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">Subclasses</code> and that would then be available to use on properties/functions like <code style="font-size:1em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">access(Subclasses)</code> and another group called <code style="font-size:1em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">Friends</code> used with <code style="font-size:1em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">access(Friends)</code>. This would give the most flexibility and allow a potentially complex combination of access controls to be moved elsewhere and re-used in the function definitions that use it.</p>
<p style="margin:0px 0px 1.2em!important">Here’s some throw-away syntax to demonstrate a few possibilities:</p>
<pre style="font-size:1em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code class="hljs language-swift" style="font-size:1em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248) none repeat scroll 0% 0%">accessgroup <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Subclasses</span> {
    type: <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Self</span>
    <span class="hljs-class"><span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">extension</span><span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">s</span>: <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">true</span> // <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">Extensions</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">of</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">types</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">matching</span> &#39;<span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">type</span>&#39; <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">can</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">access</span>
    <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">file</span>: <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">true</span> // <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">Anything</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">in</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">this</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">file</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">can</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">access</span>
}
<span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">accessgroup</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">Friends</span> </span>{
    type: <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">UIView</span>, <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Bob</span>!, <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Jeff</span> <span class="hljs-comment" style="color:rgb(153,153,136);font-style:italic">// Any UIView or Jeff type (including subtypes) and Bob (not including subtypes) can access.</span>
}
</code></pre>
<p style="margin:0px 0px 1.2em!important">This would be defined inside a type - so named groups are type-specific. This structure can then be used to define whatever type of access we decide would be useful - access by named modules / submodules? access by direct subtypes only? access only from specific functions? access from protocol-conforming types - only the functions of that protocol or any function in the conforming class? etc.</p>
<p style="margin:0px 0px 1.2em!important">You can go wild of course with what can be defined in an accessgroup - the idea here is that we start simple and then discussions about adding other access control features become a lot easier. We could even go so far as to say that existing <code style="font-size:1em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">private</code> <code style="font-size:1em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">internal</code> etc. keywords are synonyms for <code style="font-size:1em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">access(private)</code>, <code style="font-size:1em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">access(internal)</code> where <code style="font-size:1em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">private</code> and <code style="font-size:1em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">internal</code> are always-defined (reserved) accessgroup names.</p>
<div title="MDH:PGRpdiBkaXI9Imx0ciIgY2xhc3M9ImdtYWlsX21zZyI+PGRpdiBjbGFzcz0iZ21haWxfbXNnIj48
ZGl2IGNsYXNzPSJnbWFpbF9tc2ciPjxkaXYgY2xhc3M9ImdtYWlsX21zZyI+PGRpdiBjbGFzcz0i
Z21haWxfbXNnIj48ZGl2IGNsYXNzPSJnbWFpbF9tc2ciPjxkaXYgY2xhc3M9ImdtYWlsX21zZyI+
V2UgcmVhbGx5IG5lZWQgYSBwbGFjZSBmb3IgZGlzY3Vzc2lvbnMgdGhhdCBhcHBseSB0byBkZWZl
cnJlZCBpc3N1ZXMuIFNvbWUgcHJldmlvdXMgc3VnZ2VzdGlvbnMgZnJvbSBteXNlbGYgYW5kIG90
aGVycyBoYXZlIGJ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