Array patterns (and varargs patterns)

Brian Goetz brian.goetz at oracle.com
Thu Jan 7 14:18:24 UTC 2021


> Hello!
>
> While I like the idea in general, what is annoying is the necessity to
> repeat the expression type in every pattern:

This is a "primitive" -- the array analogue of the type pattern -- but 
other things can build on it.  Varargs patterns will build on it (as 
shown in the mail); if and when Java ever gets collection literals, 
there will be corresponding collection patterns too.  I think the path 
to streamlining this is not to try and simplify the syntax of the 
primitive, but move upwards to higher-level patterns.



More information about the amber-spec-experts mailing list