<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="">Oh, I admit I had never realized do could be used outside of an error handling context. Yeah, then I would agree then this change is probably unnecessary. Looking at the Swift guidebook it may be a good idea make it more explicit that the do statement is meant to be used for things other than do-try-catch, assuming that this is an intended use case. But I digress, as that would be a discussion for another time/thread.<br class=""><div class="">
<br class="Apple-interchange-newline"><span style="color: rgb(0, 0, 0); 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; display: inline !important; float: none;" class="">Sent from my Mac</span>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Jun 6, 2017, at 6:52 AM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">If I recall correctly, it was discussed during a time when additive proposals were not in scope, so it could not be proposed. Since at the moment we are currently between Swift 4 and Swift 5 evolution, the topic is not in scope either.<div class=""><br class=""></div><div class="">With respect to the idea itself, Taras's post--which appears to be the last on the subject--is useful to re-consider here:</div><div class=""><br class=""></div><div class=""><div class="">> This is definitively something very useful but it also introduces a strong asymmetry into Swift statements. In all control-flow statements, the condition is part of the outer scope. Or, to be more precise, its part of an intermediate scope between the outer and the inner scope (as you can declare variables in the condition which are invisible to the outer scope but visible to the inner scope). Your suggestion essentially moves the condition of repeat {} while () to the inner scope. I think that the more complex semantics is not worth the change. </div><div class=""><br class=""></div><div class="">I recall being initially in favor of the idea myself. However, any sort of change of syntax is a big deal; it will prompt a lot of bikeshedding, and it will require engineering effort to implement that is sorely needed elsewhere. With time, I question whether this idea meets the necessarily high bar for changing syntax; indeed if the motivation is to keep something from the outer scope, it's trivial to make this happen with an outer `do`:</div><div class=""><br class=""></div><div class="">```</div><div class="">do {</div><div class=""> var i = 0</div><div class=""> repeat {</div><div class=""> // ...</div><div class=""> } while i < 42</div><div class="">}</div><div class="">```</div><div class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jun 6, 2017 at 4:05 AM, Michael Savich via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class="">It recently occurred to me how nice it would be to be if we could avoid declaring variables outside of loops that are only used inside them. I used google’s site specific search (is that the canon way to search swift-evo?) and only found one thread about this, (<a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160718/024657.html" target="_blank" class="">https://lists.swift.org/<wbr class="">pipermail/swift-evolution/<wbr class="">Week-of-Mon-20160718/024657.<wbr class="">html</a>) where from what I could see it got a positive reception.<div class=""><br class=""></div><div class="">It would be a special case though, and within an unrelated thread I saw this suggestion (<a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/001201.html" target="_blank" class="">https://lists.swift.org/<wbr class="">pipermail/swift-evolution/<wbr class="">Week-of-Mon-20151207/001201.<wbr class="">html</a>) of letting you write a variable declaration in between the repeat keyword and the opening bracket. Personally I prefer this syntax.</div><div class=""><br class=""></div><div class="">Regardless, I’m wondering what happened to this thread? Is there a reason it didn’t get proposed? If the answer is that the discussion simply died down it may be worth revisiting it.</div><div class=""><div class="">
<br class="gmail-m_-2157267472923371982Apple-interchange-newline"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; float: none; display: inline;" class="">Sent from my Mac</span>
</div>
<br class=""></div></div><br class="">______________________________<wbr class="">_________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="">
<br class=""></blockquote></div><br class=""></div></div></div></div>
</div></blockquote></div><br class=""></body></html>