<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Once again I really like the proposal, I am rereading it after a busy week of work, one thing that gets me excited is that it makes it so the ternary syntax is no longer necessary (we can leave it for historical reasons, but I don’t see it as necessary). The question mark syntax is really saying “map” this boolean value to these other values:<div class=""><br class=""></div><div class=""><font color="#9929bd" class="">let</font> result = niceDay.<font color="#61177c" class="">map</font> {&nbsp;<font color="#61177c" class="">cases</font>&nbsp;<font color="#0042aa" class="">true</font>: <font color="#b51a00" class="">“Sunny”</font>, <font color="#006d8f" class="">false</font>: <font color="#ad3e00" class="">“Cloudy”&nbsp;</font>}</div><div class=""><br class=""></div><div class=""><div class="">compared to ternary:</div><div class=""><br class=""></div><div class=""><font color="#9929bd" class="">let</font>&nbsp;result = niceDay ?&nbsp;<font color="#b51a00" class="">“Sunny” :</font><font color="#e32400" class="">&nbsp;</font><font color="#ad3e00" class="">“Cloudy”</font></div></div><div class=""><font color="#ad3e00" class=""><br class=""></font></div><div class="">the former reads better and I think it helps make the purpose of “map" even more obvious to everyone, in other words it solves the problem of the ternary being weird magic. One thing that this lacks versus ternary is that is is not as concise. I really want to say something like this if we could add the index approach, wondering if it would make sense to add one more form so it could really be a replacement for ternary (still not saying we would remove it from the language):&nbsp;</div><div class=""><br class=""></div><div class=""><div class=""><font color="#9929bd" class="">let</font>&nbsp;result = niceDay.<font color="#61177c" class="">map</font>&nbsp;{&nbsp;<font color="#b51a00" class="">“Sunny” :</font><font color="#e32400" class="">&nbsp;</font><font color="#ad3e00" class="">“Cloudy”&nbsp;</font>}</div></div><div class=""><br class=""></div><div class="">which would almost be as compact. So the : is the default case. We could also support an indexed list:</div><div class=""><br class=""></div><div class=""><font color="#9929bd" class="">let</font> dayOfWeek = <font color="#008cb4" class="">4</font></div><div class=""><span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;result = dayOfWeek.<font color="#7b219f" class="">map</font> {&nbsp;<font color="#b51a00" class="">“Sunday”</font>, <font color="#b51a00" class="">“Monday”,</font> “<font color="#b51a00" class="">Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday” :&nbsp;”Day out of range."</font> }</div><div class=""><div class=""><br class=""></div></div><div class="">So this would introduce a third kind of syntax for a block. However, this may be better than an array lookup because it deals with a value that is out of range: &nbsp;</div><div class=""><br class=""></div><div class=""><font color="#4f7a28" class="">// array index lookup, fails</font></div><div class=""><div class=""><font color="#9929bd" class="">let</font>&nbsp;dayOfWeek =&nbsp;<font color="#008cb4" class="">8</font></div><div class=""><span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;result = dayOfWeek[<font color="#b51a00" class="">“Sunday”</font>,&nbsp;<font color="#b51a00" class="">“Monday”,</font>&nbsp;“<font color="#b51a00" class="">Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday” </font>]</div></div><div class=""><br class=""></div><div class="">I am not saying any of this has to be part of the proposal, just exploring some more ideas and focusing on how to remain concise, yet clear.</div><div class=""><br class=""></div><div class="">This goes even further but would not be part of this proposal, array could be enhanced to support a out of range value.&nbsp;</div><div class=""><br class=""></div><div class=""><div class="">let col = [<font color="#b51a00" class="">“Sunday”</font>,&nbsp;<font color="#b51a00" class="">“Monday”,</font>&nbsp;“<font color="#b51a00" class="">Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday” :&nbsp;“Out of range.”</font>]</div><div class="">col[8]&nbsp;</div><div class=""><br class=""></div><div class="">How often you you &nbsp;have an array that you don’t want to deal with out of range values. Looks like a separate proposal.&nbsp;</div><div class=""><br class=""></div></div><div class="">- Paul</div><div class=""><br class=""></div></body></html>