<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="">I prefer making “case” optional if it can be accommodated, for compactness on a single line but maybe can be provided for those doing multiline so it is more explicit.&nbsp;<div class=""><div class=""><br class=""></div><div class="">if not ? how about expression “switch?” to separate expression switch, from the switch statement? One issue is if is if ? is reserved for optionals. &nbsp;So:</div><div class=""><br class=""></div><div class="">let myColor = yourColor switch? .Blue : &nbsp;.Red, .Green: .Blue, .Red: .Green, default: .Yellow</div><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div dir="ltr" class=""></div></div></div></div></div></div></div></div></div></div></div><div class=""><div class=""><br class=""></div><div class="">or could be optionally with case with semicolons to separate, as a line continuation:</div><div class=""><br class=""></div><div class="">let myColor = yourColor switch? case .Blue : .Red; case .Green: .Blue; &nbsp;case .Red: .Green; default: .Yellow</div><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div dir="ltr" class=""></div></div></div></div></div></div></div></div></div></div></div><div class=""></div><div class="">&nbsp;</div><div class="">But “case" would be mostly for multiline:</div><div class=""><br class=""></div><div class=""><div class="">let myColor = yourColor switch?</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case .Blue : &nbsp;.Reds</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case .Green: .Blue&nbsp;</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case&nbsp;.Red: .Green</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>default: .Yellow</div><div class=""><br class=""></div><div class="">could also be written as:</div><div class=""><br class=""></div><div class=""><div class="">let myColor = yourColor switch?</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>.Blue : &nbsp;.Reds</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>.Green: .Blue&nbsp;</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>.Red: .Green</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>default: .Yellow</div></div><div class=""><br class=""></div><div class="">Also, ”if" could be expressionized:&nbsp;</div><div class=""><br class=""></div><div class="">let myColor = condition if? &nbsp;.Blue; .Red</div><div class=""><br class=""></div><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div dir="ltr" class=""></div></div></div></div></div></div></div></div></div></div></div><div class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 6, 2015, at 11:48 AM, Matthew Johnson via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I am not a fan of this approach based on the ternary operator. &nbsp;The ternary operator is already a bit of an anomaly in that all other operators are unary or binary and do not perform any control flow (beyond possibly short circuiting an autoclosure argument).<div class=""><br class=""></div><div class="">I would much rather features that perform control flow continue to use keywords, but allow them to be expressions. &nbsp;</div><div class=""><br class=""></div><div class="">Once we have control flow expressions I would like to see the ternary operator removed from the language as it would no longer server a purpose. &nbsp;Removing the ternary operator seems to fit nicely with the direction to remove some features that are carried over from C-based languages but don’t necessarily fit with the direction Swift is heading.</div><div class=""><br class=""></div><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 6, 2015, at 1:19 PM, Kevin Lundberg via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class="">


<title class=""></title>

<div class=""><div class="">Ostensibly, case may not be necessary if you could delimit each case on one line with something (perhaps a comma, or something else if that would not fit well within the grammar):<br class=""></div>
<div class="">&nbsp;</div>
<div class="">let thisColor = thatColor ? .Blue: .Red, .Green: .Blue, .Red: .Green, default: .Yellow<br class=""></div>
<div class="">&nbsp;</div>
<div class="">On Sun, Dec 6, 2015, at 01:57 PM, Paul Ossenbruggen via swift-evolution wrote:<br class=""></div>
<blockquote type="cite" class=""><div class="">I like this too, seems more powerful. &nbsp;Also, would single line expressions be allowed? &nbsp;If not would case be required for example:<br class=""></div>
<div class="">&nbsp;</div>
<div class=""><div class=""><div dir="ltr" class=""><div class="">let myFavoriteColor = yourFavoriteColor ?<br class=""></div>
<div class="">&nbsp; &nbsp; case .Blue: .Red<br class=""></div>
<div class="">&nbsp; &nbsp; case .Green: .Blue<br class=""></div>
<div class="">&nbsp; &nbsp; case .Red: .Green<br class=""></div>
<div class="">&nbsp; &nbsp; default: .Yellow<br class=""></div>
</div>
</div>
<div class=""><div class=""><div dir="ltr" class=""><div class="">&nbsp;</div>
</div>
</div>
</div>
<div class=""><div class="">&nbsp;</div>
<div class=""><blockquote type="cite" class=""><div class="">On Dec 6, 2015, at 9:11 AM, Sean Heber via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div>
<div class="">&nbsp;</div>
<div class=""><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class=""><div class="">I really like this train of thought. +1<br class=""></div>
<div class="">&nbsp;</div>
<div class="">l8r<br class=""></div>
</div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class=""><div class="">Sean<br class=""></div>
</div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class=""><div class="">&nbsp;</div>
<div class="">On Dec 6, 2015, at 11:02 AM, Alex Lew via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div>
</div>
<blockquote style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">What if we left the if { ...} else { ... } syntax alone (as a statement), and updated the ternary expression to be a more general pattern matching expression (closer to "switch")? Something like<br class=""></div>
<div class="">&nbsp;</div>
<div class="">let x = condition ?<br class=""></div>
<div class="">&nbsp; &nbsp;true: "Hello"<br class=""></div>
<div class="">&nbsp; &nbsp;false: "Goodbye"<br class=""></div>
<div class="">&nbsp;</div>
<div class="">let x = optionalValue ?<br class=""></div>
<div class="">&nbsp; &nbsp;.Some(let unwrapped): "Hello, \(unwrapped)"<br class=""></div>
<div class="">&nbsp; &nbsp;.None: "To Whom It May Concern"<br class=""></div>
<div class="">&nbsp;</div>
<div class="">let myFavoriteColor = yourFavoriteColor ?<br class=""></div>
<div class="">&nbsp; &nbsp; .Blue: .Red<br class=""></div>
<div class="">&nbsp; &nbsp; .Green: .Blue<br class=""></div>
<div class="">&nbsp; &nbsp; .Red: .Green<br class=""></div>
<div class="">&nbsp;</div>
<div class="">let quadrant = (x, y) ?<br class=""></div>
<div class="">&nbsp; &nbsp; let (x, y) where x &lt; 50 &amp;&amp; y &lt; 50: "top left"<br class=""></div>
<div class="">&nbsp; &nbsp; let (x, y) where x &lt; 50 &amp;&amp; y &gt; 50: "bottom left"<br class=""></div>
<div class="">&nbsp; &nbsp; let (x, y) where x &gt; 50 &amp;&amp; y &lt; 50: "top right"<br class=""></div>
<div class="">&nbsp; &nbsp; default: "bottom right"<br class=""></div>
<div class="">&nbsp;</div>
<div class="">The colon comes from the fact that this is sort of a light-weight expression-based "switch" statement, where each branch can only contain an expression, not a series of statements.<br class=""></div>
<div class="">&nbsp;</div>
<div class="">This is very similar to pattern matching expressions in languages like Haskell, ML, and Coq.<br class=""></div>
</div>
<div class=""><div class="">&nbsp;</div>
<div class=""><div class="">On Sun, Dec 6, 2015 at 11:25 AM, Thorsten Seitz<span class=""></span><span dir="ltr" class="">&lt;<a href="mailto:thorsten.seitz@web.de" class="">thorsten.seitz@web.de</a>&gt;</span><span class=""></span>wrote:<br class=""></div>
<blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex;" class=""><div style="word-wrap:break-word;" class=""><div class=""><div class="">&nbsp;</div>
<blockquote type="cite" class=""><div class=""><span class="">Am 06.12.2015 um 01:28 schrieb Alex Lew via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt;:</span><br class=""></div>
<div class="">&nbsp;</div>
<div class=""><div dir="ltr" class=""><div class=""><span class="">I don't think you can just get rid of the if statement in favor of an expression. You still want to be able to do this:</span><br class=""></div>
<div class="">&nbsp;</div>
<div class=""><span class="">if (condition) {</span><br class=""></div>
<div class=""><span class="">&nbsp; &nbsp; funcWithSideEffectsThatReturnsInt()</span><br class=""></div>
<div class=""><span class="">} else {</span><br class=""></div>
<div class=""><span class="">&nbsp; &nbsp; funcWithSideEffectsThatReturnsString()</span><br class=""></div>
<div class=""><span class="">}</span><br class=""></div>
<div class="">&nbsp;</div>
<div class=""><span class="">but that's not a valid expression (what is its type?).</span><br class=""></div>
</div>
</div>
</blockquote><div class="">&nbsp;</div>
<div class="">&nbsp;</div>
<div class="">That would actually be no problem if Swift’s type system would have union types (Ceylon has union and intersection types which are quite awesome and enable lots of nice things quite naturally, see<span class=""></span><a href="http://ceylon-lang.org/documentation/1.2/tour/types/" class="">http://ceylon-lang.org/documentation/1.2/tour/types/</a>).<br class=""></div>
<div class="">&nbsp;</div>
<div class="">In that case the type of such an expression would just be the union of both types, which is written<span class=""></span><span style="font-family:Courier" class="font">Int | String</span><span class=""></span>in Ceylon.<br class=""></div>
<div class="">&nbsp;</div>
<div class="">&nbsp;</div>
<div class=""><span class=""><span style="color:rgb(136, 136, 136)" class="colour">-Thorsten</span></span><br class=""></div>
<div class="">&nbsp;</div>
</div>
<div class="">&nbsp;</div>
</div>
</blockquote></div>
<div class="">&nbsp;</div>
</div>
<div class=""><img style="height:1px !important;width:1px !important;border-top-width:0px !important;border-right-width:0px !important;border-bottom-width:0px !important;border-left-width:0px !important;margin-top:0px !important;margin-right:0px !important;margin-bottom:0px !important;margin-left:0px !important;padding-top:0px !important;padding-right:0px !important;padding-bottom:0px !important;padding-left:0px !important;" alt="" src="https://www.fastmailusercontent.com/proxy/c37e5dc3a8f3d561b31011c23312a2f88559e802d2123d6f608523d08b72d0eb/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d334a7d43393f677744507b6a413a7977485e62725655485a61663534453b48467a66533d22324e4962683d2236414a47394d22324a42666258785d644253484e6578625037547c60745c4e6754694239563949785034777d223647793e4834764d223249374d2232425b6d22324c4d223248374b48494b683136707239723131656451484a69694a547769513b464c4d223646745075364a6b683e453744586e6d223248663b433159437168525074403a7677557d22364c4a5141323145637d69465a4163374f6d694567403352403365454464664e60555a40333442397360363b457447307e4077444142626271733231485a56607355673134643d2236436533743d23344/open" border="0" height="1" width="1" class=""><br class=""></div>
</div>
</blockquote><blockquote style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" type="cite" class=""><div class=""><div class=""><span class="">_______________________________________________</span><br class=""></div>
<div class=""><span class="">swift-evolution mailing list</span><br class=""></div>
<div class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""></div>
<div class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div>
</div>
</blockquote><div class=""><img style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;height:1px !important;width:1px !important;border-top-width:0px !important;border-right-width:0px !important;border-bottom-width:0px !important;border-left-width:0px !important;margin-top:0px !important;margin-right:0px !important;margin-bottom:0px !important;margin-left:0px !important;padding-top:0px !important;padding-right:0px !important;padding-bottom:0px !important;padding-left:0px !important;" alt="" src="https://www.fastmailusercontent.com/proxy/f5db77d743b9e6bcbe0444f92042db08e1374678a99825a9640c97409029eafc/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d356d6279486e60513869466736364f687876743e4e4a41585d22364758636a7e6543577b42435774413d4547777663763c44595d22324d40547a5d6877786854323f49476b405354503679666d22324a4e4f4343623a7d62474b60746a75697b42797d223249444a723f465858474d22324961567d6d6d22324431346853323d45364a4e49435847463c624b6a6947724150347a5832447962357d22324663544a6a603437773c4652555836465e676a7c4b42336f696a683269403550534331343d223246754a4657426c4a677d493a7462585b46637962474d22364e40593b444458623648444742695d22324857465671436b65333959646934335350543d23344/open" border="0" height="1" width="1" class=""><span style="font-family:Helvetica" class="font"><span class=""></span>_______________________________________________</span><br class=""></div>
<div class=""><span style="font-family:Helvetica" class="font">swift-evolution mailing list</span><br class=""></div>
<div class=""><a style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""></div>
<div class=""><a style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div>
</div>
</blockquote></div>
</div>
</div>
<div class=""><img style="height:1px !important;width:1px !important;border-top-width:0px !important;border-right-width:0px !important;border-bottom-width:0px !important;border-left-width:0px !important;margin-top:0px !important;margin-bottom:0px !important;margin-right:0px !important;margin-left:0px !important;padding-top:0px !important;padding-bottom:0px !important;padding-right:0px !important;padding-left:0px !important;" alt="" src="https://www.fastmailusercontent.com/proxy/8eefdfcb3795df48bd8a6d1794a827cd6bf84b09394d125dd9c9b31e5c4f8765/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d3148765176786c673171614a7d2236454230345272776e445d22364434385467687d62576251443136346a49494d22324450367248645a5f634438324a475437657a4355507175333b4b644163495449536a5172413649626268734a4549523b6a594137313468326f6958587c64596935786a566952685f4f4b644438543571316a595d2236457a7161705a4c6e445d2236424642496c6239603572665a63635a6f6234685d4f4f6b42657a7858316758376269603234393a5a6552693462686b413a635349757f6a4f65717735314f6743707c43344b694340727a607f4378647a433e63553a7d6760537c473d453d64714542394d23344/open" border="0" height="1" width="1" class=""><br class=""></div>
<div class=""><u class="">_______________________________________________</u><br class=""></div>
<div class="">swift-evolution mailing list<br class=""></div>
<div class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""></div>
<div class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div>
</blockquote><div class="">&nbsp;</div>

<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=eLFMrKDT8iBxZ-2Fbnk-2BZqvSchNN-2FvYXdceA0T7VxwkAf51CFZWH5W0IzpZjg7KInVyjuZhfCvBLJnEFmY-2BnDyPOTnK-2BT-2BFHmPGvSegYfm-2B7IUWE-2F5IyvVp5zMTV01-2ByOryJYAPVB7glp35IWZib8DeHk1BlokoCKZfvdpI3-2FjZhDaSmhPsgBv-2BF-2BHOMi0OvwojNaS6eb-2FPShKi-2BQzUC-2FdfGQCzYuo74hRJ9AFpwNKy5U-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>


_______________________________________________<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" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=emrIhnP1hIf76Foxxv4NNJQX-2FWhcznESwKBSwD1MEwyBlKutvuK46PoGXZ-2B5J1FhL1pJEigp1lrLcpI-2BKVYCvnmC97VmlShbUgtJc7KUb0R257m-2FY8Qtj3cdr1b1tBcke78K9h3ohEioFL7r4QTStgxr0UcnZh45IjnKSVJurab4xABV8rhIz-2FQ4DmY7jpTqsS2X90mYeWWWU2dBGkmBXA2y3T1n6-2FT9rMO9UtF-2Bei8-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</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></div></body></html>