groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: [GEP] Switch expressions syntax from Java 11 or 12 (perhaps)
Date Fri, 09 Mar 2018 22:18:57 GMT
On 09.03.2018 21:48, forax@univ-mlv.fr wrote:
[...]
> but in a switch, you can not delay the creation of a case (technically you can because
you can always do weird thing but, it's not what people will expect),
> so disallowing
>    int i = 0;
>    switch(foo) {
>      case 0 -> { i++; }
>    }
> make little sense.

but what you would do is not that, it is:

>    int i = 0;
>    i += switch(foo) {
>      case 0 -> 1 >      default -> 0;
>    }

which also means to be forced to move to a more functional style. Maybe 
you can show more examples?

bye Jochen

Mime
View raw message