[swift-evolution] ternary operator ?: suggestion

Jacob Bandes-Storch jtbandes at gmail.com
Sun Jan 17 18:34:04 CST 2016


Hi all,

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.

It was discussed a bit on the original version of this thread:
https://lists.swift.org/pipermail/swift-evolution/2015-December/000385.html

And in "Control Flow Expressions":
https://lists.swift.org/pipermail/swift-evolution/2015-December/000393.html

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".

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.

Thanks,
Jacob

On Sun, Jan 17, 2016 at 4:08 PM, Craig Cruden via swift-evolution <
swift-evolution at swift.org> wrote:

> Another attempt on motivation to thread the needle.
>
>
> https://github.com/cacruden/swift-evolution/blob/master/proposals/0000-Pattern-Matching-Partial-Function.md
>
> On 2016-01-18, at 3:04:35, Charles Constant <charles at charlesism.com>
> wrote:
>
> I think examples are convincing, but ideally we would put most of them in
> separate document.
>
> 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.
>
> 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.
>
> 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
> :(
>
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160117/05c4f41c/attachment.html>


More information about the swift-evolution mailing list