<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="">Hi Charles,<div class=""><br class=""></div><div class="">Chris, already said he did not like ? being used for ternary because it was already used for optionals. I think because of historical precedent it may be acceptable here. &nbsp;I have tried combos earlier with ! and got no support, admittedly not with the same usage as yours.&nbsp;</div><div class=""><br class=""></div><div class="">Do you really find it confusing not having a separator there? It is essentially a switch case without the word “case”. In my model the colon only indicates the “else” or “default” case, the other cases are separated by commas or whitespace. With my email taking the Swift Book examples and converting it from statement to expression form, I did not find any of them confusing, well maybe the first one, which found vowels and consonants, but that did not look that great in statement form either. .&nbsp;</div><div class=""><br class=""></div><div class="">if so maybe the | would be better as the separator because it would not change the switch like syntax:</div><div class=""><br class=""></div><div class=""><div class="" style="font-family: Menlo; margin: 0px; line-height: normal; color: rgb(0, 132, 0);"><div class="" style="margin: 0px; line-height: normal;"><span class="" style="color: rgb(187, 44, 162);">let</span><span class="" style="color: rgb(0, 0, 0);">&nbsp;numberSymbol:&nbsp;</span><span class="" style="color: rgb(112, 61, 170);">Character</span><span class="" style="color: rgb(0, 0, 0);">&nbsp;=&nbsp;</span><span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: 'PingFang SC'; color: rgb(209, 47, 27);">三</span><span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="color: rgb(0, 0, 0);">&nbsp;&nbsp;</span>// Simplified Chinese for the number 3</div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="color: rgb(187, 44, 162);">let</span>&nbsp;possibleIntegerValue:<span class="" style="color: rgb(112, 61, 170);">Int</span>? =&nbsp;<span class="" style="color: rgb(79, 129, 135);">numberSymbol</span>&nbsp;?</div><div class="" style="margin: 0px; line-height: normal;">&nbsp; &nbsp;|&nbsp;<span class="" style="color: rgb(209, 47, 27);">"1"</span>,&nbsp;<span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: 'Courier New'; color: rgb(209, 47, 27);">١</span><span class="" style="color: rgb(209, 47, 27);">"</span>,&nbsp;<span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: 'PingFang SC'; color: rgb(209, 47, 27);">一</span><span class="" style="color: rgb(209, 47, 27);">"</span>,&nbsp;<span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: Ayuthaya; color: rgb(209, 47, 27);">๑</span><span class="" style="color: rgb(209, 47, 27);">"</span>:&nbsp;<span class="" style="color: rgb(39, 42, 216);">1</span></div><div class="" style="margin: 0px; line-height: normal;">&nbsp; &nbsp;|&nbsp;<span class="" style="color: rgb(209, 47, 27);">"2"</span>,&nbsp;<span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: 'Courier New'; color: rgb(209, 47, 27);">٢</span><span class="" style="color: rgb(209, 47, 27);">"</span>,&nbsp;<span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: 'PingFang SC'; color: rgb(209, 47, 27);">二</span><span class="" style="color: rgb(209, 47, 27);">"</span>,&nbsp;<span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: Ayuthaya; color: rgb(209, 47, 27);">๒</span><span class="" style="color: rgb(209, 47, 27);">"</span>:&nbsp;<span class="" style="color: rgb(39, 42, 216);">2</span></div><div class="" style="margin: 0px; line-height: normal;">&nbsp; &nbsp;|&nbsp;<span class="" style="color: rgb(209, 47, 27);">"3"</span>,&nbsp;<span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: 'Courier New'; color: rgb(209, 47, 27);">٣</span><span class="" style="color: rgb(209, 47, 27);">"</span>,&nbsp;<span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: 'PingFang SC'; color: rgb(209, 47, 27);">三</span><span class="" style="color: rgb(209, 47, 27);">"</span>,&nbsp;<span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: Ayuthaya; color: rgb(209, 47, 27);">๓</span><span class="" style="color: rgb(209, 47, 27);">"</span>:&nbsp;<span class="" style="color: rgb(39, 42, 216);">3</span></div><div class="" style="margin: 0px; line-height: normal;">&nbsp; &nbsp;|&nbsp;<span class="" style="color: rgb(209, 47, 27);">"4"</span>,&nbsp;<span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: 'Courier New'; color: rgb(209, 47, 27);">٤</span><span class="" style="color: rgb(209, 47, 27);">"</span>,&nbsp;<span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: 'PingFang SC'; color: rgb(209, 47, 27);">四</span><span class="" style="color: rgb(209, 47, 27);">"</span>,&nbsp;<span class="" style="color: rgb(209, 47, 27);">"</span><span class="" style="line-height: normal; font-family: Ayuthaya; color: rgb(209, 47, 27);">๔</span><span class="" style="color: rgb(209, 47, 27);">"</span>:&nbsp;<span class="" style="color: rgb(39, 42, 216);">4</span></div><div class="" style="margin: 0px; line-height: normal;">&nbsp; &nbsp;|&nbsp;&nbsp;<span class="" style="color: rgb(187, 44, 162);">_</span>&nbsp;:&nbsp;<span class="" style="color: rgb(187, 44, 162);">nil</span></div><div class="" style="margin: 0px; line-height: normal;"><br class=""></div><div class="" style="margin: 0px; line-height: normal; color: rgb(79, 129, 135);"><span class="" style="color: rgb(187, 44, 162);">if</span><span class="" style="color: rgb(0, 0, 0);">&nbsp;</span><span class="" style="color: rgb(187, 44, 162);">let</span><span class="" style="color: rgb(0, 0, 0);">&nbsp;integerValue =&nbsp;</span>possibleIntegerValue<span class="" style="color: rgb(0, 0, 0);">&nbsp;{</span></div><div class="" style="margin: 0px; line-height: normal; color: rgb(209, 47, 27);"><span class="" style="color: rgb(0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span class="" style="color: rgb(61, 29, 129);">print</span><span class="" style="color: rgb(0, 0, 0);">(</span>"The integer value of&nbsp;<span class="" style="color: rgb(0, 0, 0);">\</span>(<span class="" style="color: rgb(79, 129, 135);">numberSymbol</span>) is&nbsp;<span class="" style="color: rgb(0, 0, 0);">\</span>(<span class="" style="color: rgb(0, 0, 0);">integerValue</span>)."<span class="" style="color: rgb(0, 0, 0);">)</span></div><div class="" style="margin: 0px; line-height: normal;">}&nbsp;<span class="" style="color: rgb(187, 44, 162);">else</span>&nbsp;{</div><div class="" style="margin: 0px; line-height: normal; color: rgb(209, 47, 27);"><span class="" style="color: rgb(0, 0, 0);">&nbsp; &nbsp;&nbsp;</span><span class="" style="color: rgb(61, 29, 129);">print</span><span class="" style="color: rgb(0, 0, 0);">(</span>"An integer value could not be found for&nbsp;<span class="" style="color: rgb(0, 0, 0);">\</span>(<span class="" style="color: rgb(79, 129, 135);">numberSymbol</span>)."<span class="" style="color: rgb(0, 0, 0);">)</span></div><div class="" style="margin: 0px; line-height: normal;">}</div></div><div class="" style="font-family: Menlo; margin: 0px; line-height: normal; color: rgb(0, 132, 0);">// prints "The integer value of&nbsp;<span class="" style="line-height: normal; font-family: 'PingFang SC';">三</span>&nbsp;is 3.”</div></div><div class=""><br class=""></div><div class="">But I still don’t see it a necessary. &nbsp;perhaps that would allow removal of the parenthesis and I think this would get rejected as not looking very Swift like. Also single line form which isn’t bad:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Arial; color: rgb(96, 96, 96);" class=""><b class=""><span class="" style="white-space: pre;">        </span>let&nbsp;val&nbsp;=&nbsp;color&nbsp;?&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">.Red:</b></span><b class="">&nbsp;0xFF0000 |&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">.Green:</b></span><b class="">&nbsp;0x00FF00 |&nbsp;</b><b class="">&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">.Blue:</b></span><b class="">&nbsp;0x0000FF</b><b class="">&nbsp;|&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">_:</b></span><b class="">&nbsp;0xFFFFFF</b></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Arial; color: rgb(96, 96, 96);" class=""><br class=""></div><div>But still not sure the | adds that much.</div><div><br class=""></div><div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Arial; color: rgb(96, 96, 96);" class=""><b class=""><span class="" style="white-space: pre;">        </span>let&nbsp;val&nbsp;=&nbsp;color&nbsp;?&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">.Red:</b></span><b class="">&nbsp;0xFF0000,&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">.Green:</b></span><b class="">&nbsp;0x00FF00,&nbsp;</b><b class="">&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">.Blue:</b></span><b class="">&nbsp;0x0000FF,&nbsp;</b><b class="">&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">_:</b></span><b class="">&nbsp;0xFFFFFF</b></div><div class=""><br class=""></div>Or this is without the commas is still readable but maybe a little harder:</div><div><br class=""></div><div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Arial; color: rgb(96, 96, 96);" class=""><b class=""><span class="" style="white-space: pre;">        </span>let&nbsp;val&nbsp;=&nbsp;color&nbsp;?&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">.Red:</b></span><b class="">&nbsp;0xFF0000&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">.Green:</b></span><b class="">&nbsp;0x00FF00&nbsp;</b><b class="">&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">.Blue:</b></span><b class="">&nbsp;0x0000FF&nbsp;</b><b class="">&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">_:</b></span><b class="">&nbsp;0xFFFFFF</b></div><div class=""><b class=""><br class=""></b></div></div><div>One other thing, I would still prefer the control value inside the brace rather than out front, but I see that most people still want it out front and since it would be a breaking change for ternary, I have kind of backed off it but I think this is still clearer because the control value is not floating out in front.&nbsp;</div><div><br class=""></div><div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Arial; color: rgb(96, 96, 96);" class=""><b class=""><span class="" style="white-space: pre;">        </span>let&nbsp;val&nbsp;= &nbsp;?(color,&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">.Red:</b></span><b class="">&nbsp;0xFF0000,&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">.Green:</b></span><b class="">&nbsp;0x00FF00,&nbsp;</b><b class="">&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">.Blue:</b></span><b class="">&nbsp;0x0000FF,&nbsp;</b><b class="">&nbsp;</b><span style="color: rgb(227, 36, 0);" class=""><b class="">_:</b></span><b class="">&nbsp;0xFFFFFF)</b></div><div class=""><b class=""><br class=""></b></div><blockquote type="cite" class=""><div class="">On Jan 6, 2016, at 7:06 PM, Charles Constant &lt;<a href="mailto:charles@charlesism.com" class="">charles@charlesism.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div style="font-size: 13px; margin: 0px; line-height: normal; font-family: Arial;" class=""><span style="font-family:arial,sans-serif;font-size:small" class="">&gt;&nbsp;</span><span style="font-family:arial,sans-serif" class="">I see what you are trying to do, because of the colon being both used for switch cases and&nbsp;</span><br class=""></div></div></div><div class=""><span style="font-size:13px" class="">&gt; separators for the ternary and so there needs to be a new character for each case. &nbsp;</span></div><div class=""><span style="font-size:13px" class="">&gt; I am not sure that putting colons between each case is really necessary though.</span></div><div class=""><span style="font-size:13px" class=""><br class=""></span></div><div class="">Most of us (including you and I) like a form that starts with " let val = condition ? " like the existing ternary. Let's say a proposal like that gets accepted... I really believe "colons as separators" is the best idea in the case. Otherwise, it gets pretty confusing.. we'll have the existing ternary where a colon does one thing, and our new "extra ternary" where it does something else.&nbsp;</div><div class=""><br class=""></div><div class="">This is why I like colons (this won't make sense unless your email has rich text to show the colors):&nbsp;</div><div class=""><br class=""></div><div class=""><div class=""><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Arial; color: rgb(96, 96, 96);" class=""><b class=""><span class="" style="white-space:pre">        </span>let&nbsp;val&nbsp;=&nbsp;color&nbsp;?&nbsp;</b></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Arial; color: rgb(96, 96, 96);" class=""><b class=""><span class="" style="white-space:pre">                </span></b><span style="color:rgb(227,36,0)" class=""><b class="">.Red&nbsp;!</b></span><b class="">&nbsp;<span class="" style="white-space:pre">        </span>0xFF0000&nbsp;:&nbsp;</b></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Arial; color: rgb(96, 96, 96);" class=""><b class=""><span class="" style="white-space:pre">                </span></b><span style="color:rgb(227,36,0)" class=""><b class="">.Green&nbsp;!</b></span><b class="">&nbsp;<span class="" style="white-space:pre">        </span>0x00FF00&nbsp;:&nbsp;</b></div><p style="font-size:13px;margin:0px;line-height:normal;font-family:Arial" class="">


</p><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Arial; color: rgb(96, 96, 96);" class=""><b class=""><span class="" style="white-space:pre">                </span></b><span style="color:rgb(227,36,0)" class=""><b class="">_&nbsp;!</b></span><b class="">&nbsp;<span class="" style="white-space:pre">                </span>0xFFFFFF</b></div></div></div><div class=""><b class=""><br class=""></b></div><div class="">... no syntax here different from the existing except the addition "&nbsp;<span style="font-family:Arial;font-size:13px;color:rgb(227,36,0)" class=""><b class="">.Red&nbsp;!</b></span><span style="font-size:13px;font-family:Arial" class="">&nbsp;</span>". As for the exclamation... Swift already uses an exclamation for a billion other things, which is unfortunate. But the same can be said of "?" and that's already used in a "switch" without causing confusion.&nbsp;</div><div class=""><span style="font-size:13px" class=""><br class=""></span></div><div class=""><div style="font-size: 13px; margin: 0px; line-height: normal; font-family: Arial;" class="">&gt; To point 1: I agree it needs a new name, I came up with the “demux expression”&nbsp;</div><div style="font-size: 13px; margin: 0px; line-height: normal; font-family: Arial;" class="">&gt; but maybe there is a better name.<br class=""></div></div><div class=""><span style="font-size:13px" class=""><br class=""></span></div><div class="">Has anyone suggested "multiary expression" yet? Seems in keeping with "ternary"<br class=""></div><div class=""><span style="font-size:13px" class=""><br class=""></span></div><div class=""><span style="font-size:13px" class=""><br class=""></span></div><div class=""><span style="font-size:13px" class=""><br class=""></span></div><div class=""><span style="font-size:13px" class=""><br class=""></span></div><div class=""><span style="font-size:13px" class=""><br class=""></span></div><div class=""><br class=""></div></div>
</div></blockquote></div><br class=""></div></body></html>