<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=""><div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class="">On 13 Dec 2015, at 20:31, Paul Ossenbruggen <<a href="mailto:possen@gmail.com" class="">possen@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I really don't like the "if cond then expr1 else expr2".<div class=""><br class=""></div><div class="">1) First of all, it's extremely verbose. It's almost as bad as the SQL construct "case when cond then expr1 else expr2 end”.</div></div></div></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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;" class=""><br class=""></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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; float: none; display: inline !important;" class="">Yeah it adds a few characters overall. What used to be 2 chars now takes 10. Clarity is preferred though by many. I head frequently people telling users to never use ternary operators because they are confusing to read. </span></div></div></div></blockquote><br class=""></div><div class=""><br class=""></div><div class="">I don't see the "improved" clarity.</div><div class=""><br class=""></div><div class="">Without syntax highlighting, and no indentation to help, it becomes impossible to read. Compare:</div><div class=""><br class=""></div><div class="">let x = if cond then expr1 else expr2</div><div class="">vs</div><div class="">let x = cond ? expr1 : expr2</div><div class=""><br class=""></div><div class="">The former looks just like a random English sentence, the latter is obviously a ternary expression (to my trained eye)</div><div class=""><br class=""></div><div class="">The ternary operator exists in very many languages, and therefore many programmers are familiar with them.</div><div class=""><br class=""></div><div class="">If the purpose is to make the language easier to understand for novice programmers, maybe you could use "when" instead of "if", for example:</div><div class=""><br class=""></div><div class="">let x = when cond then expr1 else expr2</div><div class=""><br class=""></div><div class="">This has several advantages:</div><div class=""><br class=""></div><div class="">1) The difference between statements and expressions becomes trivial:</div><div class="">- "if" is a statement</div><div class="">- "when" is an expression</div><div class=""><br class=""></div><div class="">2) it becomes easier to google. "swift when" might get better results compared to "swift ?" or "swift if"</div><div class=""><br class=""></div><div class="">3) people familiar with SQL will recognise the functional WHEN expression</div><div class=""><br class=""></div><div class="">4) Of course it is even longer, but at this point, who cares.</div><div class=""><br class=""></div><div class="">Jakob</div><div class=""><br class=""></div></div></div></div><br class=""></body></html>