<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="">Chris has said many things about switch as an expression:<div class=""><br class=""></div><div class=""><div class="">"if/else and switch as expressions: These are conceptually interesting things to support, but many of the problems solved by making these into expressions are already solved in Swift in other ways. Making them expressions introduces significant tradeoffs, and on balance, we haven't found a design that is clearly better than what we have so far.”</div><div class=""><br class=""></div><div class="">It is an often requested and often (i.e. every time) rejected…. and has a very high bar to pass before it would be considered. &nbsp;At a certain point there was a realization that what we were really doing was conditionally mapping from one set to another (whether the set was one value or many) — and we could provide the same functionality plus much more by focusing on a generalized solution (i.e. a design that is clearly better than what we have so far).</div></div><div class=""><br class=""></div><div class="">The thread/discussion of where this option started to be considered was the 8th of January.</div><div class=""><br class=""></div><div class="">map is an existing function and a mathematical/functional concept which if we allowed for case syntax partial function concept to conditionally map from one domain to another would cover both switch as an expression but in a more generalized way. IMHO.</div><div class=""><br class=""></div><div class="">Craig</div><div class=""><div style="widows: 1;" class=""><font color="#333333" face="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3" class=""><span style="background-color: rgb(255, 255, 255);" class=""><br class=""></span></font></div><div><blockquote type="cite" class=""><div class="">On 2016-01-18, at 7:34:04, Jacob Bandes-Storch &lt;<a href="mailto:jtbandes@gmail.com" class="">jtbandes@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi all,<div class=""><br class=""><div class="">I'm a little bit surprised that this discussion has lost track of the idea of turning "switch" into an expression rather than a control-flow statement. Chris has expressed that he and other team members would like to consider this.<br class=""></div><div class=""><br class=""></div><div class="">It was discussed a bit on the original version of this thread:</div><div class=""><a href="https://lists.swift.org/pipermail/swift-evolution/2015-December/000385.html" class="">https://lists.swift.org/pipermail/swift-evolution/2015-December/000385.html</a></div><div class=""><br class=""></div><div class="gmail_extra">And in "Control Flow Expressions":</div><div class="gmail_extra"><a href="https://lists.swift.org/pipermail/swift-evolution/2015-December/000393.html" class="">https://lists.swift.org/pipermail/swift-evolution/2015-December/000393.html</a><br class=""></div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">I've seen this ternary-operator discussion branching out in various directions and yet it slowly seems to converge back on "make it as similar to the existing switch statement as possible".</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">Was switch-as-an-expression intentionally dropped from consideration, in favor of adding new syntax? If so, I may have missed that piece of the discussion, and would appreciate if someone could point me to it.</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">Thanks,</div><div class="gmail_extra"><div class=""><div class=""><div dir="ltr" class=""><div class="">Jacob<br class=""></div></div></div></div>
<br class=""><div class="gmail_quote">On Sun, Jan 17, 2016 at 4:08 PM, Craig Cruden via swift-evolution <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span> wrote:<br class=""><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="">Another attempt on motivation to thread the needle.<div class=""><br class=""></div><div class=""><a href="https://github.com/cacruden/swift-evolution/blob/master/proposals/0000-Pattern-Matching-Partial-Function.md" target="_blank" class="">https://github.com/cacruden/swift-evolution/blob/master/proposals/0000-Pattern-Matching-Partial-Function.md</a></div><div class=""><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 2016-01-18, at 3:04:35, Charles Constant &lt;<a href="mailto:charles@charlesism.com" target="_blank" class="">charles@charlesism.com</a>&gt; wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra">I think examples are convincing, but ideally we would put most of them in separate document.&nbsp;</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">Though I love reading about programming, I generally do it in a half-assed sort of way. Unless the writing is very blunt and clear, I don't really understand it until I need to do it myself. I doubt I'm the only person here like this.&nbsp;<br class=""></div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">I badly want this proposal to gain traction (more so every time I find myself writing code that it could improve, which happens daily). I think the proposal ought to be short and sweet. I believe if we hold the reader's attention just long enough for them to understand what we're talking about, they'll be onboard. Once they're hooked, we have our second document with the list of examples.</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">It would also be great to have the "before snippet" and "after snippet" visually arranged side-by-side. I'm guessing markdown doesn't support this :(</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra"><br class=""></div></div>
</div></blockquote></div><br class=""></div></div></div></div><br class="">_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
<br class=""></blockquote></div><br class=""></div></div></div>
</div></blockquote></div><br class=""></div></body></html>