break seen as a C archaism

Louis Wasserman lowasser at google.com
Fri Mar 9 23:21:19 UTC 2018


Simplifying: let's call normal cases in a switch simple if they're a single
statement or a no-op fallthrough, and let's call a default simple if it's a
single statement or it's not there at all.

Among switches apparently convertible to expression switches,

   - 81% had all simple normal cases and a simple default.
   - 5% had all simple normal cases and a nonsimple default.
   - 12% had a nonsimple normal case and a simple default.
   - 2% had a nonsimple normal case and a nonsimple default.

I think Kevin was looking at a table that didn't take the default into
account.

On Fri, Mar 9, 2018 at 2:56 PM Brian Goetz <brian.goetz at oracle.com> wrote:

> Did you happen to calculate what percentage was _not_ the "default" case?
> I would expect that to be a considerable fraction.
>
> On 3/9/2018 5:49 PM, Kevin Bourrillion wrote:
>
> On Fri, Mar 9, 2018 at 1:19 PM, Remi Forax <forax at univ-mlv.fr> wrote:
>
> When i asked what we should do instead, the answer is either:
>>   1/ we should not allow block of codes in the expression switch but only
>> expression
>>   2/ that we should use the lambda syntax with return, even if the
>> semantics is different from the lambda semantics.
>>
>> I do not like (1) because i think the expression switch will become
>> useless
>
>
> In our (large) codebase, +Louis determined that, among switch statements
> that appear translatable to expression switch, 13.8% of them seem to
> require at least one multi-statement case.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20180309/dd88d376/attachment.html>


More information about the amber-spec-experts mailing list