<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 class="">Hi Charles,</div><div class=""><br class=""></div>Yep, someone needs to build a bike shed otherwise the bike gets all wet, but what color should it be? :-)&nbsp;<div class=""><br class=""></div><div class="">I agree that it would be really useful to keep things concise. I am going to suggest again an idea I had in the past, it is also in my proposal, which might work well for this problem. This might address the verbosity of the “case” and at the same time make it obvious we are dealing with a switch expression. So both would be valid:&nbsp;<div class=""><br class=""></div><div class=""><b class="" style="font-size: 13px; font-family: Arial;"><span class="" style="color: rgb(96, 96, 96); white-space: pre-wrap;">        </span><font color="#006d8f" class="">let</font></b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">&nbsp;num =&nbsp;color.</b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#008cb4" class="">map&nbsp;</font>{</b><br class=""><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;"><span class="" style="white-space: pre-wrap;">        </span></b><b class="" style="font-size: 13px; font-family: Arial;"><span class="" style="white-space: pre-wrap;"><font color="#606060" class="">        </font><font color="#006d8f" class="">cases</font><font color="#606060" class="">:   </font></span></b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#4f7a28" class="">.Red:</font></b><b class="" style="font-size: 13px; font-family: Arial; color: rgb(227, 36, 0);">&nbsp;</b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">100,</b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">&nbsp;</b><br class=""><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;"><span class="" style="white-space: pre-wrap;">        </span></b><b class="" style="font-size: 13px; font-family: Arial;"><span class="" style="white-space: pre-wrap;"><font color="#606060" class="">        <span class="Apple-tab-span" style="white-space:pre">        </span>      </font><font color="#4f7a28" class="">.</font></span></b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#4f7a28" class="">Green:&nbsp;</font></b><span class="" style="font-size: 13px;">&nbsp;</span><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">200</b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#e32400" class="">,</font></b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">&nbsp;</b><br class=""><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;"><span class="" style="white-space: pre-wrap;">        </span></b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;"><span class="" style="white-space: pre-wrap;">        <span class="Apple-tab-span" style="white-space:pre">        </span>      </span></b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#4f7a28" class="">.Blue</font><font color="#e32400" class="">:&nbsp;</font></b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">300</b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#e32400" class="">,</font></b><br class=""><b class="" style="font-family: Arial; font-size: 13px; color: rgb(96, 96, 96);"><span class="" style="white-space: pre-wrap;">        </span></b><b class="" style="font-family: Arial; font-size: 13px;"><span class="" style="white-space: pre-wrap;"><font color="#606060" class="">        </font><font color="#006d8f" class="">default</font></span></b><b class="" style="font-family: Arial; font-size: 13px; color: rgb(227, 36, 0);">:&nbsp;</b><b class="" style="font-family: Arial; font-size: 13px; color: rgb(96, 96, 96);">-1</b><b class="" style="font-family: Arial; font-size: 13px; color: rgb(227, 36, 0);">&nbsp;</b><br class=""><div dir="ltr" class=""><div class="" style="word-wrap: break-word;"><div dir="ltr" class=""><div class="" style="word-wrap: break-word;"><div dir="ltr" class=""><div class="" style="font-size: 13px; margin: 0px; line-height: normal; font-family: Arial;"><b class=""><span class="" style="color: rgb(227, 36, 0); white-space: pre-wrap;">        </span>}</b></div></div></div></div></div></div><div class=""><div dir="ltr" class=""><div class="" style="word-wrap: break-word;"><div dir="ltr" class=""><div class="" style="word-wrap: break-word;"><div dir="ltr" class=""><div class="" style="font-size: 13px; margin: 0px; line-height: normal; font-family: Arial;"><b class=""><br class=""></b></div><div class="" style="font-size: 13px; margin: 0px; line-height: normal; font-family: Arial;"><b class=""><b class=""><span class="" style="color: rgb(96, 96, 96); white-space: pre-wrap;">        </span><font color="#006d8f" class="">let</font></b><b class="" style="color: rgb(96, 96, 96);">&nbsp;num =&nbsp;color.</b><b class=""><font color="#008cb4" class="">map&nbsp;</font>{</b><br style="font-family: Helvetica; font-size: 12px; font-weight: normal;" class=""><b class="" style="color: rgb(96, 96, 96);"><span class="" style="white-space: pre-wrap;">        </span></b><b class=""><span class="" style="white-space: pre-wrap;"><font color="#606060" class="">        </font><font color="#006d8f" class="">case</font><font color="#606060" class="">:   </font></span></b><b class=""><font color="#4f7a28" class="">.Red:</font></b><b class="" style="color: rgb(227, 36, 0);">&nbsp;</b><b class="" style="color: rgb(96, 96, 96);">100,</b><b class="" style="color: rgb(96, 96, 96);">&nbsp;</b><br style="font-family: Helvetica; font-size: 12px; font-weight: normal;" class=""><b class="" style="color: rgb(96, 96, 96);"><span class="" style="white-space: pre-wrap;">        </span></b><b class=""><span class="" style="white-space: pre-wrap;"><font color="#606060" class="">        </font><font class="" color="#006d8f">case</font><font color="#606060" class="">:   </font><font color="#4f7a28" class="">.</font></span></b><b class=""><font color="#4f7a28" class="">Green:&nbsp;</font></b><span class="" style="font-family: Helvetica; font-weight: normal;">&nbsp;</span><b class="" style="color: rgb(96, 96, 96);">200</b><b class=""><font color="#e32400" class="">,</font></b><b class="" style="color: rgb(96, 96, 96);">&nbsp;</b><br style="font-family: Helvetica; font-size: 12px; font-weight: normal;" class=""><b class="" style="color: rgb(96, 96, 96);"><span class="" style="white-space: pre-wrap;">        </span></b><b class=""><span class="" style="white-space: pre-wrap;"><font color="#606060" class="">        </font><font color="#006d8f" class="">case</font><font color="#606060" class="">:   </font></span></b><b class=""><font color="#4f7a28" class="">.Blue</font><font color="#e32400" class="">:&nbsp;</font></b><b class="" style="color: rgb(96, 96, 96);">300</b><b class=""><font color="#e32400" class="">,</font></b><br style="font-family: Helvetica; font-size: 12px; font-weight: normal;" class=""><b class="" style="color: rgb(96, 96, 96);"><span class="" style="white-space: pre-wrap;">        </span></b><b class=""><span class="" style="white-space: pre-wrap;"><font color="#606060" class="">        </font><font color="#006d8f" class="">default</font></span></b><b class="" style="color: rgb(227, 36, 0);">:&nbsp;</b><b class="" style="color: rgb(96, 96, 96);">-1</b><b class="" style="color: rgb(227, 36, 0);">&nbsp;</b><br style="font-family: Helvetica; font-size: 12px; font-weight: normal;" class=""><div dir="ltr" class="" style="font-family: Helvetica; font-size: 12px; font-weight: normal;"><div class="" style="word-wrap: break-word;"><div dir="ltr" class=""><div class="" style="word-wrap: break-word;"><div dir="ltr" class=""><div class="" style="font-size: 13px; margin: 0px; line-height: normal; font-family: Arial;"><b class=""><span class="" style="color: rgb(227, 36, 0); white-space: pre-wrap;">        </span>}</b></div><div class="" style="font-size: 13px; margin: 0px; line-height: normal; font-family: Arial;"><b class=""><br class=""></b></div></div></div></div></div></div></b></div></div></div></div></div></div></div><div class="">So this is good in that we can avoid duplicating the word “case” which makes it much more concise. Because expressions don’t need the separating abilities of the word “case" between each group of statements, as there can only be one expression after each label. We list the matching cases, &nbsp;the if and when we need the default, we list that. This is both familiar and close enough to the existing “case". And it allows you to also use “case” for each one if you prefer. The other advantage is that we can key off first “case or cases”, as Chris mentioned, and it stands out as a switch expression and can not be confused with a dictionary.&nbsp;</div><div class=""><div class=""><br class=""></div><div class="">So on the single line version:</div><div class=""><br class=""></div><div class=""><b class="" style="font-size: 13px; font-family: Arial;"><span class="" style="color: rgb(96, 96, 96); white-space: pre-wrap;">        </span><font color="#006d8f" class="">let</font></b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">&nbsp;num =&nbsp;color.</b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#008cb4" class="">map&nbsp;</font>{<font color="#606060" class="">&nbsp;</font></b><b class="" style="font-size: 13px; font-family: Arial;"><span class="" style="white-space: pre-wrap;"><font color="#006d8f" class="">cases</font><font color="#606060" class="">: </font></span></b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#4f7a28" class="">.Red:</font></b><b class="" style="font-size: 13px; font-family: Arial; color: rgb(227, 36, 0);">&nbsp;</b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">100,</b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">&nbsp;</b><span class="">&nbsp;</span><b class="" style="font-size: 13px; font-family: Arial;"><span class="" style="white-space: pre-wrap;"><font color="#4f7a28" class="">.</font></span></b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#4f7a28" class="">Green:&nbsp;</font></b><span class="" style="font-size: 13px;">&nbsp;</span><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">200</b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#e32400" class="">,</font></b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">&nbsp;</b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#4f7a28" class="">.Blue</font><font color="#e32400" class="">:&nbsp;</font></b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">300</b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#e32400" class="">&nbsp;</font></b><b class="" style="font-family: Arial; font-size: 13px;"><span class="" style="white-space: pre-wrap;"><font color="#006d8f" class="">default</font></span></b><b class="" style="font-family: Arial; font-size: 13px; color: rgb(227, 36, 0);">:&nbsp;</b><b class="" style="font-family: Arial; font-size: 13px; color: rgb(96, 96, 96);">-1</b><b class="" style="font-family: Arial; font-size: 13px; color: rgb(227, 36, 0);">&nbsp;</b><b class="" style="font-family: Arial; font-size: 13px;">}</b><div class=""><div dir="ltr" class=""><div class="" style="word-wrap: break-word;"><div dir="ltr" class=""><div class="" style="word-wrap: break-word;"><div dir="ltr" class=""></div></div></div></div></div></div><div><br class=""></div><div>It looks pretty decent, it is pretty concise, there is no duplication, everyone should know what it means, the case part and the default part stand out pretty nicely. It would also make a hybrid line setup pretty easy as well:</div><div><br class=""></div><div><b class="" style="font-size: 13px; font-family: Arial;"><span class="" style="color: rgb(96, 96, 96); white-space: pre-wrap;">        </span><font color="#006d8f" class="">let</font></b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">&nbsp;num =&nbsp;color.</b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#008cb4" class="">map&nbsp;</font>{<font color="#606060" class="">&nbsp;</font></b></div><div><b class="" style="font-size: 13px; font-family: Arial;"><span class="" style="white-space: pre-wrap;"><font color="#006d8f" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>cases</font><font color="#606060" class="">: </font></span></b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#4f7a28" class="">.Red:</font></b><b class="" style="font-size: 13px; font-family: Arial; color: rgb(227, 36, 0);">&nbsp;</b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">100,</b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">&nbsp;</b><span class="">&nbsp;</span><b class="" style="font-size: 13px; font-family: Arial;"><span class="" style="white-space: pre-wrap;"><font color="#4f7a28" class="">.</font></span></b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#4f7a28" class="">Green:&nbsp;</font></b><span class="" style="font-size: 13px;">&nbsp;</span><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">200</b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#e32400" class="">,</font></b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">&nbsp;</b><b class="" style="font-size: 13px; font-family: Arial;"><font color="#4f7a28" class="">.Blue</font><font color="#e32400" class="">:&nbsp;</font></b><b class="" style="font-size: 13px; color: rgb(96, 96, 96); font-family: Arial;">300</b><span class=""><font color="#e32400" class="" style="font-family: Arial; font-size: 13px; font-weight: bold;">,</font></span></div><div><b class="" style="font-family: Arial; font-size: 13px;"><span class="" style="white-space: pre-wrap;"><font color="#006d8f" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>        default</font></span></b><b class="" style="font-family: Arial; font-size: 13px; color: rgb(227, 36, 0);">:&nbsp;</b><b class="" style="font-family: Arial; font-size: 13px; color: rgb(96, 96, 96);">-1</b><b class="" style="font-family: Arial; font-size: 13px; color: rgb(227, 36, 0);">&nbsp;</b></div><div><b class="" style="font-family: Arial; font-size: 13px;"><span class="Apple-tab-span" style="white-space:pre">        </span>}</b><div class=""><div dir="ltr" class=""><div class="" style="word-wrap: break-word;"><div dir="ltr" class=""><div class="" style="word-wrap: break-word;"><div dir="ltr" class=""></div></div></div></div></div></div></div><div><br class=""></div><div>This combined with the case syntax for code blocks from Scala, and map that Charles and Thorsten, have been talking about seems like a pretty decent idea to me.</div><div><br class=""></div><div>- Paul</div><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 9, 2016, at 5:58 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=""><br class=""></div><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class=""><span style="white-space:pre-wrap" class="">        </span>let&nbsp;num =&nbsp;color.</b><b style="font-size:13px;font-family:Arial" class=""><font color="#008cb4" class="">map&nbsp;</font>{</b><br style="font-size:13px" class=""><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class=""><span style="white-space:pre-wrap" class="">        </span></b><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class=""><span style="white-space:pre-wrap" class="">        </span></b><b style="font-size:13px;font-family:Arial" class=""><font color="#4f7a28" class="">.Red:</font></b><b style="font-size:13px;font-family:Arial;color:rgb(227,36,0)" class="">&nbsp;</b><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class="">100,</b><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class="">&nbsp;</b><br style="font-size:13px" class=""><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class=""><span style="white-space:pre-wrap" class="">        </span></b><b style="font-size:13px;font-family:Arial" class=""><span style="white-space:pre-wrap" class=""><font color="#606060" class="">        </font><font color="#4f7a28" class="">.</font></span></b><b style="font-size:13px;font-family:Arial" class=""><font color="#4f7a28" class="">Green:&nbsp;</font></b><span style="font-size:13px" class="">&nbsp;</span><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class="">200</b><b style="font-size:13px;font-family:Arial" class=""><font color="#e32400" class="">,</font></b><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class="">&nbsp;</b><br style="font-size:13px" class=""><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class=""><span style="white-space:pre-wrap" class="">        </span></b><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class=""><span style="white-space:pre-wrap" class="">        </span></b><b style="font-size:13px;font-family:Arial" class=""><font color="#4f7a28" class="">.Blue</font><font color="#e32400" class="">:&nbsp;</font></b><b style="font-size:13px;color:rgb(96,96,96);font-family:Arial" class="">300</b><b style="font-size:13px;font-family:Arial" class=""><font color="#e32400" class="">,</font></b><br style="font-size:13px" class=""><div style="word-wrap:break-word" class=""><div dir="ltr" class=""><div style="font-size:13px;margin:0px;line-height:normal;font-family:Arial" class=""><b style="color:rgb(96,96,96)" class=""><span style="white-space:pre-wrap" class="">        </span></b><b style="color:rgb(96,96,96)" class=""><span style="white-space:pre-wrap" class="">        </span></b><b class=""><font color="#4f7a28" class="">_</font></b><b style="color:rgb(227,36,0)" class="">&nbsp;:&nbsp;</b><b style="color:rgb(96,96,96)" class="">-1</b><b style="color:rgb(227,36,0)" class="">&nbsp;</b></div><div style="font-size:13px;margin:0px;line-height:normal;font-family:Arial" class=""><b class=""><span style="color:rgb(227,36,0);white-space:pre-wrap" class="">        </span>}</b></div><div style="font-size:13px;margin:0px;line-height:normal;font-family:Arial" class=""><b class=""><br class=""></b></div><div style="font-size:13px;margin:0px;line-height:normal;font-family:Arial" class=""><b class=""><br class=""></b></div><div style="margin:0px;line-height:normal" class="">Looks like I forgot to mention what my previous message regards: I mean that if we go with "map", I prefer the version that doesn't require "case" be written.<br class=""></div><div style="font-size:13px;margin:0px;line-height:normal;font-family:Arial" class=""><span style="font-family:arial,sans-serif" class=""><br class=""></span></div><div style="margin:0px;line-height:normal" class="">I also realize whether we're verbose&nbsp;enough depends on how commonly people use this type of expression. If it is accepted, but unpopular, then I'd concede "verbose" makes more sense.&nbsp;</div><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class="">Anyways, I'll try to lurk for a while now, instead of posting, as I'm veering toward the bike-shed :)</div><div style="margin:0px;line-height:normal" class=""><br class=""></div></div></div><div class="gmail_extra"><br class=""></div></div>
</div></blockquote></div><br class=""></div></div></div></div></body></html>