<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="">Braces don’t preclude using `break` or `continue`, why would they preclude `fallthrough`?<div class=""><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 7, 2016, at 13:33 , Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Fallthrough ceases to make much sense with braces, and it is a handy feature of switch statements every so often.<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Jul 7, 2016 at 15:31 Roth Michaels via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Jul 07 2016 at 04:07:06 PM, G B via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:<br class="">
> I feel like this would be more consistent with the rest of the syntax:<br class="">
><br class="">
> switch x {<br class="">
> case 0 { print(0) }<br class="">
> case 1 { print(1) }<br class="">
> case 2 { print(2) }<br class="">
> default { print("other”) }<br class="">
> }<br class="">
><br class="">
> The colon syntax evokes a label, but the modern, complex `case`<br class="">
> statements in Swift don’t act much like labels.<br class="">
<br class="">
I sort of see what you are saying about `case` not seeming like a label<br class="">
since we don't have GOTO in Swift.<br class="">
<br class="">
I prefer the colon vs your brace suggestion, because from my<br class="">
perspective, the `switch` expression is the control flow statement and<br class="">
to the cases are like some sort of label even if they include complex<br class="">
pattern matching.<br class="">
<br class="">
While Scala drops the colon to avoid case statements looks like labels,<br class="">
but uses => instead of whitespace and {} --- I prefer this to your<br class="">
suggestion, but as I said also think the colon is fine.<br class="">
<br class="">
--<br class="">
Roth Michaels<br class="">
<a href="mailto:roth@rothmichaels.us" target="_blank" class="">roth@rothmichaels.us</a><br class="">
<br class="">
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" 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/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></div></body></html>