<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="">Good point, maybe breaking it up makes sense. <div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 13, 2015, at 8:05 AM, J. Cheyo Jimenez <<a href="mailto:cheyo@masters3d.com" class="">cheyo@masters3d.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">This is great. Here is my take on it. <div class=""><br class=""></div><div class="">Should these be two proposals? One for the if-then-else expression and one for the switch expression?</div><div class="">I think the proposal would have a better chance if it is focused first on replacing ?: with if-then-else. It is a very emotional change for a lot of people. At the end of the proposal you could just briefly mention the switch expression possibility (I like Al's suggestions.)</div><div class=""><br class=""></div><div class="">If the if then else expression gets approved and implemented then it would be easier to get a switch expression using the then keyword imo but I do think we need to include it in the proposal but as a future implementation and/or possibility. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><br class="">On Saturday, December 12, 2015, Paul Ossenbruggen via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">Hello All, </div><div class=""><br class=""></div><div class="">Been sick in bed all day, but decided to try to be productive…</div><div class=""><br class=""></div>I did a rough draft of a proposal for implementing if expressions and switch expressions based upon the discussions we had here. I have tried to keep the scope of the changes as small as possible, only added one keyword and kept things as similar to the existing language constructs as possible. If anyone wants to help me with this, or has feedback, please let me know,<div class=""><br class=""></div><div class=""><a href="https://github.com/possen/swift-evolution/blob/master/0020.md" target="_blank" class="">https://github.com/possen/swift-evolution/blob/master/0020.md</a></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">- Paul</div><div class=""><br class=""><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 12, 2015, at 3:51 PM, Paul Ossenbruggen <<a href="javascript:_e(%7B%7D,'cvml','possen@gmail.com');" target="_blank" class="">possen@gmail.com</a>> wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class="">Implied in using the “then", if…then…else would aways require “else" when using “then” similar to how “guard" requires “else”. This will help to make the difference between statements and expressions clear.<div class=""><br class=""></div><div class="">let x = If cond then X else Y</div><div class=""><br class=""></div><div class="">is the full form, where “else" can not be omitted. </div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On Dec 12, 2015, at 12:59 PM, Paul Ossenbruggen <<a href="javascript:_e(%7B%7D,'cvml','possen@gmail.com');" target="_blank" class="">possen@gmail.com</a>> wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class=""><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 12, 2015, at 12:37 PM, Andrey Tarantsov via swift-evolution <<a href="javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');" target="_blank" class="">swift-evolution@swift.org</a>> wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class=""><div class="">1. I would really hate to explain to someone when <b class="">if</b> needs a <b class="">then</b> and when it doesn't. That's the sort of inconsistency that shouldn't be added lightly.</div></div></div></blockquote><div class=""><br class=""></div><div class="">agreed definitely want to be careful with that. I think with braces meaning statements that differentiation can be made clear. I would certainly start with statements when describing, just as you usually don’t talk about the ternary operator until later. </div></div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap:break-word" class=""><div class="">3. If we can somehow solve all of this, I think I'll be +1 for replacing (A ? B : C) with some sort of (<b class="">if</b> A <b class="">then</b> B <b class="">else</b> C).</div></div></div></blockquote><div class=""><br class=""></div>Yes that would be great.</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap:break-word" class=""><div class=""><br class=""></div><div class="">4. Generally, I wonder how hard would it be for all statements to be usable as expressions? Why didn't Swift go that way from the start?</div></div></div></blockquote><div class=""><br class=""></div><div class="">The biggest problem statement is you don’t need to exhaustively specify every outcome:</div><div class=""><br class=""></div><div class="">if cond {</div><div class=""><span style="white-space:pre-wrap" class="">        </span>print(“hello”)</div><div class="">}</div><div class=""><br class=""></div><div class="">whereas in an expression you have to specify what happens in the else.</div><div class=""><br class=""></div><div class="">let say = if cond then “hello” else “goodbye"</div></div><div class=""><br class=""></div><div class="">unless you go seriously off the deep end:</div><div class=""><br class=""></div><div class="">let say = if cond then “hello” </div><div class=""><br class=""></div><div class=""> “say" then becomes an optional, *shudder*</div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=OWK4tSasaK2n-2FQIIcS9Ug-2FuFXG-2BJ3z6cFMLgm306hDfq0Zu7qOB7D-2FqpbP8beei9GBOq2COJ5wjEe-2FJTduG28lVM7gr8ZPkq7Rwl0qpQsyNUJ4pWsps6xO6lfOXz5UCUOxXk-2FqTISEiplkvzPn4IxZwGnPCBwd5tLN1qNtSOorWcK4NzFrh-2BzdzV0xq4O3-2FKHPHrzsoqxfqcXSHj1b-2Ba3X60MkT9wjhPJDlOVU6P8Z0-3D" alt="" width="1" height="1" border="0" style="min-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>
</blockquote></div>
</div></blockquote></div><br class=""></div></body></html>