<div dir="ltr">On Thu, Dec 3, 2015 at 3:09 PM, Douglas Gregor &lt;<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>&gt; wrote:<br>&gt;<br>&gt;&gt; On Dec 3, 2015, at 2:59 PM, Felix Gabel &lt;<a href="mailto:felix.gabel@me.com">felix.gabel@me.com</a>&gt; wrote:<br>&gt;&gt;<br>&gt;&gt; Hey everyone,<br>&gt;&gt;<br>&gt;&gt; I hereby propose adding a ’sealed’ modifier for protocols to enable library developers to declare protocols that can be only conformed to in the scope of the library itself. This is similar to a ’sealed trait’ in Scala with the difference that it does not limit the protocol to be only applicable in the file it is declared in.<br>&gt;&gt;<br>&gt;&gt; Example:<br>&gt;&gt;<br>&gt;&gt; public sealed protocol FooType {<br>&gt;&gt;    // this protocol can be conformed to only in scope of the library itself<br>&gt;&gt;    // it can NOT be conformed to by any object declared outside the library<br>&gt;&gt; }<br>&gt;&gt;<br>&gt;&gt; What do you think?<br>&gt;<br>&gt;<br>&gt; Can you elaborate on why a Swift developer would want to distinguish between “public sealed” and “internal”?<br><br>There are cases when the library isn&#39;t designed to support new conformances for the protocol, but the protocol is public because other public APIs are expressed in terms of it.<br><br>We have a case for it in the standard library, &#39;protocol AnyCollectionType&#39;.  Foundation also has a use case -- property list types.<div><br></div><div>Dmitri<br><br>-- <br>main(i,j){for(i=2;;i++){for(j=2;j&lt;i;j++){if(!(i%j)){j=0;break;}}if<br>(j){printf(&quot;%d\n&quot;,i);}}} /*Dmitri Gribenko &lt;<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>&gt;*/</div></div>