JEP325: Switch expressions spec
Guy Steele
guy.steele at oracle.com
Mon Apr 23 18:27:27 UTC 2018
Good point, Rémi. However, note that
case pat1, pat2 -> s
is equally too close to
case pat1 -> pat2 -> s
and again they have very different meanings.
We have to admit that there is room to blunder with this syntax.
One way out would be to use a different arrow for `switch` statements:
switch (x) {
case pat1 => case pat2 => s1;
case pat3 => pat4 -> s2;
case pat5, pat6 => s2;
case pat 7, pat8 => pat9 -> s4;
}
> On Apr 23, 2018, at 2:29 PM, Remi Forax <forax at univ-mlv.fr> wrote:
>
> I agree with Kevin,
> case pat1 -> case pat2 -> s
> is too close to
> case pat1 -> pat2 -> s
> which has a very different meaning (the result is a lambda).
>
> Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20180423/db1f51af/attachment.html>
More information about the amber-spec-experts
mailing list