Can you not write this?<br><br>switch condition {<br> case 1: do {<br> //<br> }<br><br> case 2: do {<br> //<br> }<br>}<br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 23, 2016 at 8:35 AM Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Marco,<br class="gmail_msg"><br class="gmail_msg">This idea has already been discussed on this list; however, source-breaking changes require "extreme" justification and this particular idea has not been found to provide obvious benefit. Moreover, Swift cases allow fallthrough, which is less explicable when you surround each case with braces.<br class="gmail_msg"><br class="gmail_msg">The focus of this phase of Swift Evolution is listed on the GitHub site and is generally clustered around ABI stability and completing generics.<br class="gmail_msg"><br class="gmail_msg">Cheers,<br class="gmail_msg"><br class="gmail_msg">Xiaodi<br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Fri, Dec 23, 2016 at 07:04 Marco Scannadinari via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="m_3230664784804537968m_-426353171785884330inbox-inbox-uyb8Gf gmail_msg" style="color:rgb(33,33,33);font-size:13px"><div class="gmail_msg"><div class="m_3230664784804537968m_-426353171785884330inbox-inbox-F3hlO gmail_msg"><div dir="ltr" class="gmail_msg">Hi,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I found it odd that the `label:` style is used for switch-case conditions, considering that Swift does not have implicit fallthrough. To me the label style only makes sense if you think of conditions essentially as labels for a goto statement, which implies fallthrough.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Personally I think this syntax would make more sense:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">switch condition {</div><div class="gmail_msg"> case 1 {</div><div class="gmail_msg"> //</div><div class="gmail_msg"> }</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> case 2 {</div><div class="gmail_msg"> //</div><div class="gmail_msg"> }</div><div class="gmail_msg">}</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">This is how Rust implements match, although it is an expression so it especially applies to that context. Nonetheless I think the above syntax not only looks a lot nicer but makes more sense, especially since the current syntax is the only instance where Python-style colons and indentation are used for designating sections of code rather than braces.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Thoughts?</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">-Marco</div></div></div></div></div></div>
_______________________________________________<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 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>