<div dir="ltr">You can already effectively have these &quot;regions&quot; using extensions, with the exception of stored properties since they can&#39;t be placed there.<div><br></div><div>struct MyType { ... }</div><div>public extension MyType { ... }<br></div><div>private extension MyType { ... }</div><div><br></div><div>Once stored properties are allowed in extensions (IIRC supporting that within the same file as the type declaration is something the core team has said is reasonable?), you could do this there as well. Is this not sufficient for what you want to do?</div><div><br></div><div>Since there are already two ways of specifying the visibility of a type member (preceding the type itself, or using the default visibility of the declaring extension), I&#39;d be wary of adding a third.</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jun 19, 2017 at 10:57 PM Rien via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I don’t like this, it violates the locality principle. I.e. that all information that is needed to understand something is close by.<br>
<br>
But since it is not something that everybody has to use… I don’t object to it either.<br>
<br>
Regards,<br>
Rien<br>
<br>
Site: <a href="http://balancingrock.nl" rel="noreferrer" target="_blank">http://balancingrock.nl</a><br>
Blog: <a href="http://swiftrien.blogspot.com" rel="noreferrer" target="_blank">http://swiftrien.blogspot.com</a><br>
Github: <a href="http://github.com/Balancingrock" rel="noreferrer" target="_blank">http://github.com/Balancingrock</a><br>
Project: <a href="http://swiftfire.nl" rel="noreferrer" target="_blank">http://swiftfire.nl</a> - An HTTP(S) web server framework in Swift<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
&gt; On 17 Jun 2017, at 23:48, Ted F.A. van Gaalen via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt; (I am not sure if I should tag this subject with [pitch]? )<br>
&gt;<br>
&gt; Please don’t worry , I am not attempting to start a new<br>
&gt; and infinite thread about whether or not the way scope<br>
&gt; is handled in Swift is imho correct or not.<br>
&gt; Errhm well, apart from that “protected” is missing,<br>
&gt; but please let us not start again.. :o)<br>
&gt;<br>
&gt; No, it is more or less a convenience solution to<br>
&gt; prevent unnecessary wear and tear to the following keys<br>
&gt; on my keyboard: [ A,E, I, P,  R, T, V]<br>
&gt;<br>
&gt; I prefer it, not to expose those class or struct members<br>
&gt; which should not be accessible outside the class or struct<br>
&gt;<br>
&gt; Currently, to prevent access to private Items,<br>
&gt; I have to type the word “private” too many times:<br>
&gt;<br>
&gt; class  House<br>
&gt; {<br>
&gt;         private var rooms = 5<br>
&gt;       private var roofTiles = 11201<br>
&gt;       private let paint =   UIColor.Blue;<br>
&gt;         private var yearTax: Money = “323,56&quot;<br>
&gt;         private let garageVolume = 60.0<br>
&gt;<br>
&gt;         init(..) {.. }<br>
&gt;<br>
&gt;          private func calculateTax() {...}<br>
&gt;<br>
&gt;          public func roomsUnoccupied() -&gt; Int {…}<br>
&gt;<br>
&gt;         func roofData(……) {…}<br>
&gt;<br>
&gt;          private func  a{…}<br>
&gt; }<br>
&gt;<br>
&gt; To set the scope of a list of members I suggest the<br>
&gt; “in-line scope modifiers”  (anyone with a better name for it?)<br>
&gt;<br>
&gt; For example if one has a source line containing the word<br>
&gt; “private:” then all the following member declarations will<br>
&gt; be “private” until another inline scope modifier is encountered<br>
&gt; with one “default scope” to escape from it. like in the following example”<br>
&gt;<br>
&gt; The compiler can detect that it is an inline scope modifier, because it ends with a colon<br>
&gt;<br>
&gt; “Normal” scope modifiers, that is the ones which precede the member’s name<br>
&gt; directly should imho not be allowed within such a scope block.<br>
&gt; unless they would override for that specific item, but that looks ugly.<br>
&gt;<br>
&gt; getter &amp; setters and init should appear in default scope<br>
&gt; (or with no in-line scope modifiers)<br>
&gt;<br>
&gt; Inline scope modifiers can be specified as often as<br>
&gt; desired and in arbitrary sequence.<br>
&gt;<br>
&gt;<br>
&gt; class  House<br>
&gt; {<br>
&gt;          init(..) {.. }<br>
&gt;     private:                                            // &lt;——  In-line scope modifier all following declarations are private here.<br>
&gt;             var rooms = 5<br>
&gt;           var roofTiles = 11201<br>
&gt;           let paint =   UIColor.Blue;<br>
&gt;             var yearTax: Money = “323,56&quot;<br>
&gt;             func calculateTax() {…}<br>
&gt;             func  a{…}<br>
&gt;<br>
&gt;       public:                                             // &lt;——  In-line scope modifier<br>
&gt;          var garageVolume = 60.0<br>
&gt;          func roomsUnoccupied() -&gt; Int {…}<br>
&gt;          func roofData(……) {…}<br>
&gt;<br>
&gt;       defaultscope:                                 // &lt;—— Return to default scope (only needed when preceding inline scope modifiers are present. )<br>
&gt;<br>
&gt;           func sellHouse(buyer: CustomerID)<br>
&gt; }<br>
&gt;<br>
&gt; See? looks a lot better, don’t you think so?<br>
&gt; it also makes sources more readable because one can<br>
&gt; now conveniently group items.<br>
&gt;<br>
&gt; 100% source compatible with whatever scope<br>
&gt; mechanism now or in the future is or will be deployed.<br>
&gt;<br>
&gt;<br>
&gt; (The idea is not exactly new, a similar construct is available in Object Pascal.)<br>
&gt;<br>
&gt; ?<br>
&gt;<br>
&gt; Kind Regards<br>
&gt; TedvG<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; swift-evolution mailing list<br>
&gt; <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>