<html><head><style>
body {
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        padding:1em;
        margin:auto;
        background:#fefefe;
}

h1, h2, h3, h4, h5, h6 {
        font-weight: bold;
}

h1 {
        color: #000000;
        font-size: 28pt;
}

h2 {
        border-bottom: 1px solid #CCCCCC;
        color: #000000;
        font-size: 24px;
}

h3 {
        font-size: 18px;
}

h4 {
        font-size: 16px;
}

h5 {
        font-size: 14px;
}

h6 {
        color: #777777;
        background-color: inherit;
        font-size: 14px;
}

hr {
        height: 0.2em;
        border: 0;
        color: #CCCCCC;
        background-color: #CCCCCC;
    display: inherit;
}

p, blockquote, ul, ol, dl, li, table, pre {
        margin: 15px 0;
}

a, a:visited {
        color: #4183C4;
        background-color: inherit;
        text-decoration: none;
}

#message {
        border-radius: 6px;
        border: 1px solid #ccc;
        display:block;
        width:100%;
        height:60px;
        margin:6px 0px;
}

button, #ws {
        font-size: 12 pt;
        padding: 4px 6px;
        border-radius: 5px;
        border: 1px solid #bbb;
        background-color: #eee;
}

code, pre, #ws, #message {
        font-family: Monaco;
        font-size: 10pt;
        border-radius: 3px;
        background-color: #F8F8F8;
        color: inherit;
}

code {
        border: 1px solid #EAEAEA;
        margin: 0 2px;
        padding: 0 5px;
}

pre {
        border: 1px solid #CCCCCC;
        overflow: auto;
        padding: 4px 8px;
}

pre > code {
        border: 0;
        margin: 0;
        padding: 0;
}

#ws { background-color: #f8f8f8; }


.bloop_markdown table {
border-collapse: collapse;  
font-family: Helvetica, arial, freesans, clean, sans-serif;  
color: rgb(51, 51, 51);  
font-size: 15px; line-height: 25px;
padding: 0; }

.bloop_markdown table tr {
border-top: 1px solid #cccccc;
background-color: white;
margin: 0;
padding: 0; }
     
.bloop_markdown table tr:nth-child(2n) {
background-color: #f8f8f8; }

.bloop_markdown table tr th {
font-weight: bold;
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }

.bloop_markdown table tr td {
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }

.bloop_markdown table tr th :first-child, table tr td :first-child {
margin-top: 0; }

.bloop_markdown table tr th :last-child, table tr td :last-child {
margin-bottom: 0; }

.bloop_markdown blockquote{
  border-left: 4px solid #dddddd;
  padding: 0 15px;
  color: #777777; }
  blockquote > :first-child {
    margin-top: 0; }
  blockquote > :last-child {
    margin-bottom: 0; }

code, pre, #ws, #message {
    word-break: normal;
    word-wrap: normal;
}

hr {
    display: inherit;
}

.bloop_markdown :first-child {
    -webkit-margin-before: 0;
}

code, pre, #ws, #message {
    font-family: Menlo, Consolas, Liberation Mono, Courier, monospace;
}


.send { color:#77bb77; }
.server { color:#7799bb; }
.error { color:#AA0000; }</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="bloop_markdown"><p>Real type nesting vs. extension nesting creates a new visibility boundary. If your type somehow depends on the visibility of your parent type scope, it could became problematic. Just speaking generally here.</p>

<p>Bikeshedding:</p>

<pre><code class="swift">struct A {
    struct B {}
}

extension A {
    struct C {}
}

// Could be written as

@scoped
struct A.B {}

@extension // where this could be by default and fully inferred
struct A.C {}  
</code></pre>

<p></p></div><div class="bloop_original_html"><style>body{font-family:Helvetica,Arial;font-size:13px}</style><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div> <br> <div id="bloop_sign_1479666061373112064" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">--&nbsp;<br>Adrian Zubarev<br>Sent with Airmail</div></div> <br><p class="airmail_on">Am 20. November 2016 um 19:06:13, Derrick Ho via swift-evolution (<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>) schrieb:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>


<title></title>


<div dir="ltr">Alexander, I took your code and "flattened" it with
what currently exists in Swift 3.&nbsp; Is this not flat enough for
you?
<div><br></div>
<div>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(186,45,162)">
<span style="font-variant-ligatures:no-common-ligatures">struct</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">A
{</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures;white-space:pre">&nbsp;</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)">var</span>
<span style="font-variant-ligatures:no-common-ligatures">a =</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(39,42,216)">0</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures">}</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px">
<br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(186,45,162)">
<span style="font-variant-ligatures:no-common-ligatures">extension</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)">A</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">{</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures"><span style="white-space:pre">&nbsp;</span> <font color="#BA2DA2">struct</font></span> <span style="color:rgb(0,0,0);font-variant-ligatures:no-common-ligatures">B
{</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures;white-space:pre">&nbsp;</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)">var</span>
<span style="font-variant-ligatures:no-common-ligatures">b =</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(209,47,27)">"Bee"</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures"><span style="white-space:pre">&nbsp;</span> }</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures">}</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px">
<br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(186,45,162)">
<span style="font-variant-ligatures:no-common-ligatures">extension</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)">A</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)">B</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">{</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures"><span style="white-space:pre">&nbsp;</span> <font color="#BA2DA2">struct</font></span> <span style="color:rgb(0,0,0);font-variant-ligatures:no-common-ligatures">C
{</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures;white-space:pre">&nbsp;</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)">var</span>
<span style="font-variant-ligatures:no-common-ligatures">c =</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(39,42,216)">0</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures;white-space:pre">&nbsp;</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)">func</span>
<span style="font-variant-ligatures:no-common-ligatures">someFunc()
{</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures;white-space:pre">&nbsp;</span>
<span style="color:rgb(62,30,129);font-variant-ligatures:no-common-ligatures">print</span><span style="color:rgb(0,0,0);font-variant-ligatures:no-common-ligatures">(</span><span style="color:rgb(209,47,27);font-variant-ligatures:no-common-ligatures">"something"</span><span style="color:rgb(0,0,0);font-variant-ligatures:no-common-ligatures">)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures"><span style="white-space:pre">&nbsp;</span> }</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures"><span style="white-space:pre">&nbsp;</span> }</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">
<span style="font-variant-ligatures:no-common-ligatures">}</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px">
<br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,132,0)">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)">A</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">().</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)">a</span>
<span style="font-variant-ligatures:no-common-ligatures">// print
0</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,132,0)">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)">A</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)">B</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">().</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)">b</span>
<span style="font-variant-ligatures:no-common-ligatures">// Print
"Bee"</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,132,0)">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)">A</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)">B</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)">C</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">().</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(49,89,93)">someFunc</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">()</span>
<span style="font-variant-ligatures:no-common-ligatures">// Print
"something"</span></p>
<div><br></div>
<div><br></div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Sun, Nov 20, 2016 at 10:23 AM Alexander Doloz 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">
About scope visibility rules – I think, for now this new syntax
should behave exactly like the old. What’s possible with old syntax
should be possible with the new and vice versa.<br class="gmail_msg">
To Robert Widmann’s question about real situation where such syntax
will be useful – right now I have a project where nested types are
used. They are good for my situation, but:<br class="gmail_msg">
1. When they appear directly in the outer type I have to take extra
effort to distinguish between properties and methods of outer type
vs. properties and methods of inner type.<br class="gmail_msg">
2. And yes, indents. I don’t do something crazy - I have only I
place where 3 types are nested. But even if there are 2 types, it
becomes inconvenient to read code in the methods of the last nested
type.<br class="gmail_msg">
New syntax solves this issues.<br class="gmail_msg">
&gt; 20 нояб. 2016 г., в 16:00, Rien &lt;Rien@Balancingrock.nl&gt;
написал(а):<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; Imo, it does not need extreme nested code to be useful. I find
that more than 1 level of nesting tends to create obfuscation.
Probably because we loose the ability to associate type C with type
A. By allowing "struct A.B.C" it is very clear that C does indeed
depend on A.<br class="gmail_msg">
&gt; However, I can already see questions coming: how to refer to
struct A elements and can we introduce new scope visibility
rules?<br class="gmail_msg">
&gt; Still, I like this way of programming, so for me its a
+1<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; Regards,<br class="gmail_msg">
&gt; Rien<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; Site: <a href="http://balancingrock.nl" rel="noreferrer" class="gmail_msg" target="_blank">http://balancingrock.nl</a><br class="gmail_msg">
&gt; Blog: <a href="http://swiftrien.blogspot.com" rel="noreferrer" class="gmail_msg" target="_blank">http://swiftrien.blogspot.com</a><br class="gmail_msg">
&gt; Github: <a href="http://github.com/Swiftrien" rel="noreferrer" class="gmail_msg" target="_blank">http://github.com/Swiftrien</a><br class="gmail_msg">
&gt; Project: <a href="http://swiftfire.nl" rel="noreferrer" class="gmail_msg" target="_blank">http://swiftfire.nl</a><br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt;&gt; On 20 Nov 2016, at 04:18, Robert Widmann via
swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt;
wrote:<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; I think this is an interesting proposal, but I don't write
enough extremely-nested code to know that it will do much more than
save you some whitespace - as you say.&nbsp; What situation have
you run into specifically where this kind of code is both
called-for and headache-inducing?<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; ~Robert Widmann<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; 2016/11/19 18:48、Alexander Doloz via swift-evolution
&lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; のメッセージ:<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; Hello, Swift community!<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; Right now, when we declare nested types in Swift, we
have to literally nest them:<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; // Swift 3<br class="gmail_msg">
&gt;&gt;&gt; struct A {<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; var a = 0<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; struct B {<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; var b = 0<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; struct C {<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var c = 0<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; func someFunc()
{<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if
something {<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
}<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; }<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; }<br class="gmail_msg">
&gt;&gt;&gt; }<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; By nesting types this way we waste amount of indents
we can do without losing readability. In the example above, code
inside if statement will already be far away from left
border.<br class="gmail_msg">
&gt;&gt;&gt; I propose to allow do nested types like
this:<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; // Proposal<br class="gmail_msg">
&gt;&gt;&gt; struct A {<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; var a = 0<br class="gmail_msg">
&gt;&gt;&gt; }<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; struct A.B {<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; var b = 0<br class="gmail_msg">
&gt;&gt;&gt; }<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; struct A.B.C {<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; var c = 0<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; func someFunc() {<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; if something {<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; }<br class="gmail_msg">
&gt;&gt;&gt;&nbsp; }<br class="gmail_msg">
&gt;&gt;&gt; }<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; No more unnecessary indentation.<br class="gmail_msg">
&gt;&gt;&gt; Of course, the old way should also continue to
work.<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;
_______________________________________________<br class="gmail_msg">
&gt;&gt;&gt; swift-evolution mailing list<br class="gmail_msg">
&gt;&gt;&gt; <a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
&gt;&gt;&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">

&gt;&gt; _______________________________________________<br class="gmail_msg">
&gt;&gt; swift-evolution mailing list<br class="gmail_msg">
&gt;&gt; <a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
&gt;&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">

&gt;<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote>
</div>


_______________________________________________<br>swift-evolution mailing list<br>swift-evolution@swift.org<br>https://lists.swift.org/mailman/listinfo/swift-evolution<br></div></div></span></blockquote></div><div class="bloop_markdown"><p></p></div></body></html>