<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>I haven't thought of doing it this way This is why these reviews are great. I agree with Craig that, we would not allow commas before the colon. The proposal probably should be updated to make sure that is clear.&nbsp;</div><div id="AppleMailSignature"><br>Thanks&nbsp;</div><div id="AppleMailSignature">- Paul&nbsp;</div><div id="AppleMailSignature"><br>Sent from my iPhone</div><div><br>On Feb 4, 2016, at 10:31 AM, Maximilian Hünenberger &lt;<a href="mailto:m.huenenberger@me.com">m.huenenberger@me.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div class="">I definitely see the point against dictionaries but I’m afraid of the actual pattern matching in "cases".</div><div class=""><br class=""></div><div class="">match(1) {</div><div class="">&nbsp; &nbsp; case 1, 3: 10</div><div class="">&nbsp; &nbsp; case 2, 4: 20</div><div class="">&nbsp; &nbsp; default: 30</div><div class="">}</div><div class=""><br class=""></div><div class="">// with "cases"</div><div class=""><br class=""></div><div class=""><div class="">match(1) { cases</div><div class="">&nbsp; &nbsp; 1, 3: 10,</div><div class="">&nbsp; &nbsp; 2, 4: 20,</div><div class="">&nbsp; &nbsp; default: 30</div><div class="">}</div></div><div class=""><br class=""></div><div class="">// it is very hard to disambiguate between pattern and return value even though for the compiler it could be doable</div><div class=""><div class="">match(1) { cases</div><div class="">&nbsp; &nbsp; 1, 3: 10, 2, 4: 20, default: 30</div><div class="">}</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">There should be a more visible distinction between two "<span style="color: rgb(51, 51, 51); background-color: rgb(255, 255, 255);" class="">case-item-map" <b class=""><u class="">like</u></b> "|". But we have to consider "expression-patterns" where operators (like "|") are ambiguous.</span></div><div class=""><span style="color: rgb(51, 51, 51); background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#333333" class="">-&nbsp;Maximilian</font></span></div><br class=""><div><blockquote type="cite" class=""><div class="">Am 04.02.2016 um 18:48 schrieb Paul Ossenbruggen &lt;<a href="mailto:possen@gmail.com" class="">possen@gmail.com</a>&gt;:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">That is a good point and I forgot about that. There are frequent cases where what I am dealing with is not hashable and it is generally a lot of work to make it hashable, including adding a heading function which if done wrong, can lead to errors. &nbsp;<br class=""><br class="">Sent from my iPhone</div><div class=""><br class="">On Feb 4, 2016, at 8:38 AM, Charles Constant via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">I still vote for keeping "cases"</div><br class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">I see it as a replacement for dictionary literal "pattern matching":<br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(209,47,27)" class=""><span style="" class="">[</span><span style="color:rgb(39,42,216)" class="">1</span><span style="" class=""> : </span>"one"<span style="" class="">, </span><span style="color:rgb(39,42,216)" class="">2</span><span style="" class=""> : </span>"two"<span style="" class="">, </span><span style="color:rgb(39,42,216)" class="">3</span><span style="" class=""> : </span>"three"<span style="" class="">][</span><span style="color:rgb(39,42,216)" class="">1</span><span style="" class="">] ?? </span>"undefined"</div></div><div class=""></div></div></blockquote><div class=""><br class=""></div><div class="">A dictionary needs keys that are Hashable. A dictionary produces an optional. We've discussed this, and more, earlier in the thread.</div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">Even though it would be nice to have but I don’t think that I would use it frequently.</div></div></blockquote><div class=""><br class=""></div><div class="">Granted, it's a bit ugly, but given the choice, I would pick "cases" over "case case case case ..." every time.</div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">In addition, to be more consistent with "case", "cases" would introduce pattern matching which doesn’t seem right with this concise syntax.</div></div></blockquote><div class=""><br class=""></div><div class="">I haven't thought this through. It just bums me out a little to replace the switch with something that still has imho unnecessary verbosity.</div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></div>
</div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></div></blockquote></div><br class=""></div></blockquote></body></html>