[switch] Further unification on switch

Guy Steele guy.steele at oracle.com
Thu Apr 19 21:06:35 UTC 2018

> On Apr 19, 2018, at 4:44 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> We've been reviewing the work to date on switch expressions. Here's where we are, and here's a possible place we might move to, which I like a lot better than where we are now.
> . . .
> ## Closing the gap
> So, let's take one more step towards unifying the two forms (call this UA2), rather than a step away from it.  Let's say that _all_ switches can support either old-style (colon) or new-style (arrow) case labels -- but must stick to one kind of case label in a given switch . . .
> The result is one switch construct, with modern and legacy flavors, which supports either expressions or statements.  You can immediately look at the middle of a switch and tell (by arrow vs colon) whether it has the legacy control flow or not.

I like it.

I would like to think that an IDE could help you with changing between colon and arrow flavors.


More information about the amber-spec-observers mailing list