Switch expressions -- gathering the threads

forax at univ-mlv.fr forax at univ-mlv.fr
Tue Apr 10 22:47:45 UTC 2018



----- Mail original -----
> De: "daniel smith" <daniel.smith at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "Brian Goetz" <brian.goetz at oracle.com>, "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Mercredi 11 Avril 2018 00:20:01
> Objet: Re: Switch expressions -- gathering the threads

>> On Apr 10, 2018, at 2:30 PM, Remi Forax <forax at univ-mlv.fr> wrote:
>> 
>> I'm not sure this difference is important.
>> 
>> What about the example below, multiple labels or a fallthrough ?
>>   switch(x) {
>>       case 0:
>>         ;
>>       case 1:
>>   }
> 
> My request is to call this an example of fallthrough.
> 
> I think you're trying to make a point that some forms of switches with
> fallthrough behave the same as switches with multiple labels. Sure, that's
> fine. I still think it's helpful to talk about the two cases separately, as
> distinct features, because the practical use cases are very different.

I think is see all forms as being fallthrough and what you call a multiple labels form as the result after a peephole optimization, i.e if there is no instruction between the two cases, then the compiler will make them share the same label.

> 
> —Dan

Rémi


More information about the amber-spec-experts mailing list