Small things Java lets you do, but not everywhere.
Adowrath
cyrill.brunner at hispeed.ch
Tue Aug 21 14:03:14 UTC 2018
> - array literals
> we already have them no ?
> new int[] { 2, 3, 5};
> if you mean supported in the bytecode, yes, we are working on that as a follow up of ConstantDynamic.
>
>
Seeing as they explicitly mentioned "I can imagine `return` statements
working really well with it, ...", I think they refer to the shorthand
instead.
i.e. That you can do this:
int[] a = {2, 3};
But can't do any of these:
int[] a; a = {2, 3};
int[] f() { return {2, 3}; }
void g(int[] a) {} g({2, 3});
For all of these cases and possibly more, the shorthand literals are not
allowed and explicit type information has to be added. To their point
about expression switch, I think it's to allow this:
break {2, 3};
But with moving closer to patterns at a later stage, I think this would
also be helpful
switch(...) {
case {2, 3} -> ...;
default -> ...;
}
Regards,
Cyrill Brunner
More information about the amber-spec-observers
mailing list